Understanding Android broadcasts

Android applications can send or receive messages. Messages can be system-related events or custom ones defined by us. Interested parties are registered for certain messages by defining a proper intent filter and broadcast receiver. When a message is broadcast, all interested parties are notified. It is important to note that once you subscribe for broadcast messages (especially from the Activity class), you must unsubscribe at some point. When can we use broadcast messages? We use broadcast messages when we need a messaging system across our application. For example, imagine you started a long running process in the background. At some point, you want to notify multiple contexts about processing results. ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.