Broadcast Receivers for system events

3652
0

BroadcastReceiver responds to system-wide or app-specific events. I register receivers statically in AndroidManifest or dynamically with registerReceiver(). The onReceive() method handles broadcasts—network changes, battery status, boot completed, SMS received. Ordered broadcasts allow priority and result propagation. Local broadcasts limit scope to app with LocalBroadcastManager. Permission requirements protect sensitive broadcasts. Background execution limits on Android 8+ require JobScheduler or WorkManager for most system events. Receivers enable responding to system state changes and inter-component communication. Common use cases include syncing on network availability, reacting to power changes, or handling custom app events.