Mobile App Development 2021W Lecture 21
Video
Video from the lecture given on March 31, 2021 is now available.
Notes
Lecture 21 ---------- * Assignment 3 solutions * app manifest * Intents - explicit - implicit * drawable shapes * touch events Tutorial 9 and A4 will come out this week, probably tomorrow. Tutorial 10 will be optional and on iOS storyboard - can substitute for a tutorial that you missed - won't be on the final exam Application manifest - tells Android how to run the app - this is where you define activities - really, classes that are associated with layouts - and also define intents your app will respond to - such as launching the app Intents are the basic inter-process communication mechanism on android - think of them as messages that can be sent between programs, including a program to itself - used to launch activities (By the way, intents are built on mechanisms that are not Linux-native, rely on modifications to the Linux kernel that were only upstreamed relatively recently) idea is to do fast message passing with minimal amount of memory copying - copying memory is slow - example, zero-copy networking If you want to start a new class with a new screen, standard way is to use an intent - and your new class will have to set things up just as we did in MainActivity, including specifying the layout - be sure to add the activity to the application manifest Launching your own class as a new activity is an "explicit" intent - you specified what code should run (i.e., the class) But in many contexts, you don't know what code to run - you want a service provided by another application Implicit intents let you make requests when you don't know what application will handle the request. - simple example: open web page in a browser - when you specify a default browser in android, you are specifying what browser will handle intents such as ACTION_VIEW You have to be careful when defining intents, especially implicit intents - can be called by arbitrary apps - so, you may need to do access control - can be a big security hole, depending on how they are used If you care about security or privacy at all as a developer, you need to pay attention to android intents and the permissions associated with them Drawable shapes - in iOS SwiftUI, we'd just say Circle, Rectangle etc and we'd get shapes - in Android, it is a bit more complicated - with a canvas, we can do these things programmatically much like a canvas in a web page - but in a regular view, you need to specify drawings using drawable shapes and paths normally specified in XML - you can display using an ImageView (just like a jpeg) Touch events in Android are a lot more complicated than in SwiftUI - we're not going to achieve parity with iOS in this class, that will have to wait until 2601 Regarding grading - assignments, tutorials, and participation can only improve your grade relative to the midterm and final