Android apps support three primary programming languages: Kotlin, Java, and C++. The core Android building blocks—four key components—remain foundational and stable for now.
Key Components
Service
Services handle background operations like music playback, dynamic wallpaper rendering, notification monitoring, screen savers, input methods, and accessibility support. While Google acknowledges limitations in service flexibility, widespread adoption means no major changes are planned.
Broadcast Receiver
A lightweight component primarily used as a gateway to other parts of your app, designed for minimal processing. For instance, it might trigger a JobService (via JobScheduler) to execute work based on an event. Implemented as a subclass of BroadcastReceiver, each broadcast is delivered as an Intent.
Note: From API 30 (Android R) onward,
JobSchedulerthrottles apps with excessive scheduling calls (a sign of bugs), regardless of target SDK version.
Content Provider
Serves as a system-visible app entry point that exposes structured data items identified by URI schemas.
Component Launch Methods
For services:
- Android 5.0 (API 21+) supports
JobSchedulerfor scheduling. - Lower API levels still use
startServiceorbindService. Always use explicitIntents to launch services; implicitIntents forbindService()will throw an exception starting from API 21.
Version Compatibility
To declare feature or API requierments for your app, use manifest tags:
<manifest ... >
<uses-feature android:name="android.hardware.camera.any" android:required="true" />
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="19" />
...
</manifest>
This declaration blocks installation on devices without a camera or Android versions below 2.1. If you're app uses a camera but doesn’t require it, set android:required="false" and check for camera availability at runtime before enabling camera features.