A comprehensive Android project demonstrating core architectural components and modern development practices. This project serves as a practical guide for implementing Activities, Intents, Services, Broadcast Receivers, and WorkManager using Jetpack Compose.
Demonstrates how to communicate between components:
- Explicit Intent (Internal): Navigating between activities within the same app.
- Explicit Intent (External): Launching specific external applications (e.g., YouTube) using package names.
- Implicit Intent: Sharing content (text/email) by declaring an action and letting the system find suitable apps.
Shows the different types of Android Services and their lifecycles:
- Foreground Service: Used for tasks the user is actively aware of (e.g., data sync). Includes notification management and API 26+ requirements.
- Background Service: Demonstrates independent background operations and discusses restrictions introduced in Android 8.0 (Oreo).
- Dynamic Registration: Implements an
AirPlaneModeReceiverto listen for system-wide events (ACTION_AIRPLANE_MODE_CHANGED) at runtime. - Best Practices: Includes proper registration in
onCreateand unregistration inonDestroyto prevent memory leaks.
A real-world example of background processing:
- PhotoCompressionWorker: Uses
CoroutineWorkerto compress images shared from other apps. - Constraints: Ensures tasks run only when storage is not low.
- Data Flow: Uses
LiveDataandViewModelto observe worker status and display compressed results in the UI.
- Jetpack Compose: Fully declarative UI built with Material 3.
- Coil: Efficient image loading for both URIs and Bitmaps.
- Architecture: Follows MVVM pattern using
ViewModelandLiveData. - Edge-to-Edge: Implements modern Android display standards.
- Language: Kotlin
- UI Framework: Jetpack Compose
- Design System: Material 3
- Image Loading: Coil
- Background Work: WorkManager
- Dependency Management: Gradle Version Catalog (libs.versions.toml)
- Share an Image: Share an image from your gallery to this app.
- Process:
onNewIntenttriggers theWorkManager. - Compress:
PhotoCompressionWorkerreduces the image size below 20KB in the background. - Display: The UI automatically updates to show the original and the compressed version once finished.
Each component is heavily documented with code comments explaining:
- The "Why" behind specific implementations.
- API level differences (e.g., Android 13+ permission handling).
- Lifecycle management best practices.