Lecturer: Ali Najimi Faculty of Computer Engineering Sharif University of Technology Fall 2027
Android Architecture Lifecycle Permissions APK
Android is a stack of software components. Understanding this stack is crucial.
Key Takeaway: Your app sits at the top, but it relies heavily on the layers below.
The foundation. It is the only part of the OS that interacts directly with the hardware.
Note: Android does not use the standard Linux kernel exactly; it has specific modifications for mobile power management.
The HAL (Hardware Abstraction Layer) provides standard interfaces that expose device hardware capabilities to the higher-level Java API.
Every Android app runs in its own process, with its own instance of the ART virtual machine.
The set of tools and APIs you use to build Android apps.
Where the user interacts.
AndroidManifest.xml is the control file for your app. Without it, the OS doesn't know your app exists.
AndroidManifest.xml
Key Roles:
edu.sharif.mp
android.intent.action.MAIN
An APK (Android PacKage) is just a ZIP file containing all app resources.
classes.dex
resources.arsc
res/
lib/
.so
META-INF/
The Activity Lifecycle is the most critical concept to master. If you get this wrong, you leak memory and crash.
Active States
Killer States
Why did my app disappear?
Stopped
onPause()
onSaveInstanceState()
Golden Rule: Do not trust that your app's static variables will survive a background kill.
Objective: Create a simple app that logs lifecycle events.
onStart
onResume
onPause
onStop
onDestroy
Logcat
adb shell
onCreate
adb shell am kill edu.sharif.mp
// High-level pseudo-code for Flutter implementation startForegroundService() { // Keeps process alive even if UI is destroyed }
"A UI engineer walks into a bar. The bartender says, 'Sorry, we don't serve your thread here.' The engineer replies, 'It's okay, I'll just wait on the Main Thread.'"