Mobility
Mobile-first software design:
- What does this mean?
- What makes mobile software different from desktop software?
- Inherently personal
- Ubiquitous: always with us
- Situated:
- Location-aware
- Understands local context through sensors
- Orientation, cameras, Bluetooth etc.
- Connected
- Wi-Fi, cellular, Bluetooth
- Finite
- Limitations: limited memory, CPU, battery etc.
Mobile is a platform:
A “platform” is a system that can be programmed and therefore customized by outside developers—users—and in that way, adapted to countless needs and niches that the platform’s original developers could not have possibly contemplated, much less had time to accommodate.
Marc Andreeson
Cultural trends:
- Apps are casual
- Apps must assume short, interruptible and unplanned sessions
- Apps are paranoid
- Build to be robust: assume network signal can go out, battery can die, app can be killed at any moment
- Apps are personal
- Phones are an extension of our brain: we offload our memory, computing (e.g. maps) onto the phone
- Apps are social
Android vs iOS:
- Apps: commercially, mostly need to have support for both iOS and Android.
- For the course, Android is chosen because as the development tools are open source, allowing both Windows and macOS devices to be used for Android development.
The course
First term (6 weeks) - basics of Android required to build any app.
Second term: location, camera, sensors etc.
Assignment 1: 30%, due 5pm 24 August. Individual assignment.
Assignment 2: 30%, due 5pm 19 October. Group assignment (3 people).
Final exam: 40%.
Not covering cross-platform languages/frameworks: will always lag behind what the native implementations can offer.
Introduction to Android
Android is a software stack for mobile devices, including:
- An operating system
- Middleware
- Key applications
Linux is used to provide core system services:
- Security
- Memory management
- Process management
- Power management
- Hardware drivers
Android versioning:
- ~30 versions over 12 years
- Now about one major release per year
- Android version number != API level
Android Project Structure
manifests/AndroidManifest.xml:
- XML file
- Acts like a table of contents
- Register main activity - starting point for the app
- Declares target, min SDK
- Declares all components of the app: activities, services
- Request permissions
Source code:
- In
/javadirectory, even for Kotlin projects (/srcin the file system) androidTest: for unit tests using the Android emulatortestfor Android-independent tests
Resource file:
/resdirectorydrawable: imageslayout: XML description of view layoutsmenu: XML menu specificationsvalues: strings, dimensions, colors, lists of dataraw: other files (e.g. audio, video)xml: other general-purpose XML files
Gradle:
- Build tool
- Need to configure to pull in external libraries (e.g. Jetpack packages) into the binary
Android Runtime (ART, formerly Dalvik VM):
- Subset of Java developed by Google, optimized for mobile
- Does ahead-of-time compilation (AOT)
- Runs
.dexbytecode files compiled from.classfiles - Creates compiled extended and linkable format (ELF) executables
- Does not support some Java libraries (e.g. AWT, Swing)
Boxing:
- Each app run in its own Linux process
- Can create additional threads for long-running operations
- Each app assigned a unique Linux ID
- App can only access its own files
Packaging:
- Java code compiled by
javacinto bytecode, Kotlin code bykotlinc - Those class files, plus those from external libraries, are compiled into
.dexfiles by `dx - Android Manifest file, resources, and the
dexbytecode packaged into a.apkfile byaapt
Android Debug Bridge (adb):
- CLI tool to interact with emulator or Android device