Android Tutorial
Build native mobile apps with the world's most popular open-source mobile platform
Table of Contents
1What is Android?
Android is an open-source, Linux-based operating system designed primarily for touchscreen mobile devices like smartphones and tablets. It was developed by a startup of the same name, purchased by Google in 2005, and officially unveiled in 2007.
Unlike iOS (which is closed and exclusive to Apple devices), Android is open-source via the Android Open Source Project (AOSP). This allows device manufacturers (Samsung, Xiaomi, OnePlus, etc.) to customize the OS for their hardware. Android powers billions of devices globally, including watches (Wear OS), TVs (Android TV), cars (Android Auto), and even some laptops.
Android is not just a phone OS; it's a complete software stack for connected devices.
2Features of Android
Android's popularity comes from its rich set of features:
Multitasking
True background processing; run multiple apps simultaneously (e.g., music while browsing).
Customizable Home Screen
Widgets, live wallpapers, and custom launchers for a personalized experience.
Notification System
Rich, expandable, actionable notifications — reply to messages from the shade.
Google Integration
Seamless sync with Gmail, Drive, Photos, Calendar, and Assistant.
Connectivity
GSM, CDMA, LTE, 5G, Wi-Fi, Bluetooth, NFC, and USB support.
Media Support
Wide codecs (MP4, MKV, FLAC) and image formats on diverse hardware.
Hardware Flexibility
Works across screen sizes, ARM/x86 processors, and sensors.
Accessibility
TalkBack, voice access, switch access, and magnification gestures.
Security & Privacy
App sandboxing, runtime permissions, verified boot, biometrics, Play Protect.
3Android Versions (History & Evolution)
Android versions originally had dessert code names (alphabetical order) and numeric API levels. Since Android 10, Google uses version numbers only.
| Version | Code Name | API Level | Key Features Introduced |
|---|---|---|---|
| 1.5 | Cupcake | 3 | On-screen keyboard, video recording |
| 4.4 | KitKat | 19 | "OK Google" hotword, immersive mode |
| 5.0 | Lollipop | 21 | Material Design (flat UI), ART runtime |
| 6.0 | Marshmallow | 23 | Runtime permissions, fingerprint support |
| 7.0 | Nougat | 24 | Split-screen mode, bundled notifications |
| 8.0 | Oreo | 26 | Picture-in-picture (PIP), notification channels |
| 9.0 | Pie | 28 | Gesture navigation, Adaptive Battery |
| 10 | (no dessert) | 29 | Dark theme, system-wide privacy controls |
| 11 | – | 30 | Conversation notifications, one-time permissions |
| 12 | – | 31 | Material You (dynamic color theming) |
| 13 | – | 33 | Themed app icons, per-app language settings |
| 14 | – | 34 | AI-generated wallpapers, better battery health |
| 15 | – | 35 | Partial screen sharing, improved performance |
4Android Architecture (Software Stack)
Android is built as a layered stack. From bottom (hardware) to top (apps):
1 Linux Kernel
Role: Abstraction layer between hardware and software.
Handles: Drivers (display, camera, audio, Wi-Fi), power management, memory management, and process isolation.
Why Linux? Proven security and driver model.
2 Hardware Abstraction Layer (HAL)
Role: Standard interface for hardware vendors to implement without exposing kernel details.
Example: Camera HAL allows OEMs to write custom camera drivers that still work with Android's camera API.
3 Android Runtime (ART) & Native Libraries
ART: Executes app bytecode (DEX format) ahead-of-time (AOT) or just-in-time (JIT). Replaced Dalvik in Lollipop for better performance.
Native Libraries: C/C++ libraries – libc, OpenGL, SQLite, WebKit, MediaCodec.
4 Application Framework
Role: Provides high-level Java/Kotlin services to apps.
Key Managers: Activity Manager, Window Manager, Package Manager, Notification Manager, Content Providers, Location Manager.
5 Applications
System Apps: Phone, Contacts, Settings, Camera, etc.
User Apps: Downloaded from Play Store. All apps run in isolated sandboxes for security.
5Advantages of Android
| Advantage | Explanation |
|---|---|
| Open Source | Vendors can customize; developers can study and modify the OS. |
| Hardware Choice | Hundreds of devices at all price points (budget to flagship). |
| Google Services | Free access to Google Drive, Photos, Maps, Assistant, etc. |
| Customization | Home screen launchers, icon packs, third-party keyboards, rooting. |
| Large Developer Community | Millions of developers; vast libraries and tools. |
| Multi-tasking | True split-screen, floating windows (on some OEMs), background processing. |
| File System Access | Users can browse files natively (unlike iOS's restricted access). |
| Expandable Storage | Most devices support microSD cards (flagships are dropping this). |
| Google Play Store | Largest app catalog with rigorous testing (though some malware exists). |
6Android Applications
An Android app is a package (.apk or .aab) containing code, resources (images, layouts), and a manifest.
Common App Types
Native Apps
Written in Kotlin/Java using Android SDK, installed on device.
Hybrid Apps
Web technologies wrapped in a native container (Cordova, Ionic).
Progressive Web Apps
Accessed via browser but can be installed and work offline.
System Apps
Pre-installed with system-level privileges.
App Components (from framework)
| Component | Purpose |
|---|---|
| Activity | One screen with UI (e.g., login screen). |
| Service | Background task (e.g., music player playing in background). |
| Broadcast Receiver | Responds to system events (e.g., battery low, SMS received). |
| Content Provider | Manages shared data (e.g., contacts, photos). |
Where to run? Emulator (AVD) or physical device.
7Android Ecosystem
The ecosystem extends far beyond phones:
Wear OS
Smartwatches — Samsung Galaxy Watch, Pixel Watch.
Android TV / Google TV
Smart TV platform — Chromecast, Sony, TCL.
Android Auto
Car dashboard experience — maps, music, messages.
Google Play Services
Proprietary APIs for Maps, Location, Firebase (not AOSP).
Third-Party Stores
Amazon Appstore, Samsung Galaxy Store, F-Droid.
OEM Customizations
One UI, OxygenOS, MIUI — features plus fragmentation.
8Android SDK Overview
The Software Development Kit (SDK) is a set of tools and libraries that allow developers to build Android apps.
What's inside the SDK?
| Component | Purpose |
|---|---|
| Platform Tools | adb (Android Debug Bridge), fastboot, systrace |
| Build Tools | aapt (Android Asset Packaging Tool), dex, zipalign |
| Android Emulator | Virtual devices (AVDs) for testing |
| SDK Platforms | System images and libraries for each API level (e.g., API 34 for Android 14) |
| Support Libraries | Jetpack (Room, Navigation, ViewModel) |
| Command-line tools | sdkmanager, avdmanager |
How to set up?
- Install Android Studio (recommended IDE) – includes SDK by default.
- Alternatively, install command-line tools from developer.android.com.
- Set environment variable
ANDROID_HOMEto SDK path.
Key SDK concepts
Essential tools in depth
- ADB (Android Debug Bridge): Command-line interface to communicate with a device/emulator.
- Logcat: System logging tool – crucial for debugging crashes and warnings.
- Layout Inspector: Visual tool in Android Studio to examine UI hierarchy.
- Profiler: Real-time monitoring of CPU, memory, network, and battery usage.
Hello World code sample (Kotlin)
9Summary Cheatsheet
| Topic | Key Takeaway |
|---|---|
| What is Android? | Linux-based open-source OS by Google |
| Core Features | Multitasking, notifications, customization, Google services |
| Versions | Cupcake (1.5) to Android 15; API level is key for devs |
| Architecture | Linux Kernel → HAL → ART/Native Libs → Framework → Apps |
| Advantages | Choice, customization, large community, open-source |
| Apps | Activities, Services, Broadcast Receivers, Content Providers |
| Ecosystem | Phones, watches, TV, Auto, Play Services |
| SDK | Tools: ADB, emulator, platform tools; managed via Android Studio |
10Next Steps for Learning
Install Android Studio and create a "Hello World" project.
Explore ADB: Connect a real device (enable Developer Options and USB Debugging).
Understand lifecycle: Read about Activity and Fragment lifecycle callbacks.
Build a simple UI with ConstraintLayout and handle button clicks.
Study Jetpack Compose (modern UI toolkit) – Google's recommended future for Android UI.
Android MCQ Practice
10 Basic MCQs 10 Advanced MCQs10 Basic Android MCQs
What is Android primarily based on?
What does AOSP stand for?
Which company currently leads Android development?
What are the four core Android app components?
Which language is Google's preferred choice for Android development?
What is the official IDE for Android development?
Which runtime executes Android apps since Android 5.0 (Lollipop)?
What does API level represent in Android?
Which tool is used to communicate with a connected Android device from the command line?
What is Jetpack in Android?
10 Advanced Android MCQs
What is the purpose of the Hardware Abstraction Layer (HAL)?
Why does ViewModel survive configuration changes like screen rotation?
What is the difference between explicit and implicit Intents?
In MVVM architecture, what is the role of the Repository?
When should you use WorkManager instead of a foreground Service?
What is Jetpack Compose primarily used for?
What does R8 do in a release build?
What is the main advantage of Room over raw SQLiteOpenHelper?
Why observe LiveData with viewLifecycleOwner in Fragments?
What format is required for uploading new apps to Google Play?
15 Interview Questions & Answers
Easy Medium HardonCreate(), onStart(), onResume(), onPause(), onStop(), onDestroy() — that manage an Activity's state as the user navigates in and out of the screen.minSdk and targetSdk?easyminSdk is the lowest Android version your app supports. targetSdk tells the system which API level you tested against — newer behavior changes apply at the target level.ActivityResultContracts.RequestPermission(). The user can grant or deny each permission.