Android App - Sandboxed, every app creates it own users, i.e different users cannot see each other’s content - Unique application identifier (Reverse domain names) - Install via Android Package format (APK)
● Entry point for background tasks ● Foreground services where user is aware of (music playback, uploading a document.. etc), cannot be killed by System. ● Background service where user is not aware of (syncing data quietly), can be killed by System Service
● Receives events emitted by system (and other apps) such as dialing, low battery etc. ● Used mostly for alarm-based tasks or reacting to system changes Broadcast Receivers
Activating Components Components are activated through Intent (with the exception of Content Provider. Intent is the API that tells the system what the user wants to do.
//Tell system user want to view url val intent = Intent(Intent.ACTION_VIEW).apply { data = "http://www.example.com".toUri() } startActivity(intent) //Staring a service val serviceIntent = Intent(this, MyService::class.java) startService(serviceIntent) //or startForegroundService() //Register battery low events (you can also do this via Manifest) registerReceiver(BatteryLevelReceiver(), IntentFilter(Intent.ACTION_BATTERY_CHANGED))
APK ownership Each app is signed by a unique keystore+pass, where each keystore can have different alias+pass. If someone steal and modify the content, they cannot use the same keystore, and republish on stores and devices,
● Don’t need to worry about losing/managing keystore file ● Better Security ● App Bundle has Instant Apps, Dynamic Features Google App Signing Pros ● How can we know for sure Google won’t modify the contents? ● Platform tied-in ● App Bundle causes crash in some devices Cons https://commonsware.com/blog/2020/09/23/uncomfortable-questions-app-signing.html
adb shell am start -W -a android.intent.action.VIEW -d adb shell am start -W -a android.intent.action.VIEW -d "https://example.com" com.google.chrome # Create an alias alias adOpenIntent=adb shell am start -W -a android.intent.action.VIEW -d Testing DeepLinks
Recap ● 4 main components: Activity, Service, Broadcast Receiver & Content Provider ● Manifest tells your app’s capabilities to the OS ● Never lose your keystore ● Weigh the pros and cons of app bundle & play app signing ● Utilize ADB for efficiency in your work (Shameless plug: https://www.aungkyawpaing.dev/useful-adb-commands/)