System broadcasts

System broadcasts are the ones that are sent by the Android system when various system events happen. Every message we send and finally receive is wrapped in the Intent class containing information about that particular event. Each Intent must have a proper action set. For example--android.intent.action.ACTION_POWER_CONNECTED. Information about the event is represented with bundled extra data. For example, we may have bundled an extra string field representing particular data related to the event we are interested in. Let's consider an example of charging and battery information. Each time the battery status changes, interested parties will be notified and receive a broadcast message with information about the battery level: ...

Get Mastering Android Development with Kotlin now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.