54
CHAPTER 5: Broadcasts
Listening to System Broadcasts
To
listen to system broadcasts, see the list in the online text companion’s “System
Broadcasts” section. You can just use a programmatic registration as shown earlier. For
most of them, you cannot use the manifest registration method for background execution
limits imposed since Android 8.0 (API level 26). However,
for a number of them, you can also
use the manifest file to specify listeners.
ACTION_LOCKED_BOOT_COMPLETED
,
ACTION_BOOT_COMPLETED
:
Apps may
need those to schedule jobs, alarms, and so on.
ACTION_USER_INITIALIZE
,
"android.intent.action.USER_ADDED"
,
"android.intent.action.USER_REMOVED"
:
These are protected by privileged permissions,
so the use cases are
limited.
"android.intent.action.TIME_SET"
,
ACTION_TIMEZONE_CHANGED
,
ACTION_
NEXT_ALARM_CLOCK_CHANGED
:
These are needed by clock apps.
ACTION_LOCALE_CHANGED
:
The locale changed, and apps might need to
update their data when this
happens.
ACTION_USB_ACCESSORY_ATTACHED
,
ACTION_USB_ACCESSORY_DETACHED
,
ACTION_USB_DEVICE_ATTACHED
,
ACTION_USB_DEVICE_DETACHED
:
These are USB-related events.
ACTION_CONNECTION_STATE_CHANGED
,
ACTION_ACL_ CONNECTED
,
ACTION_ACL_DISCONNECTED
:
These are Bluetooth events.
ACTION_CARRIER_CONFIG_CHANGED
Dostları ilə paylaş: