In this chapter, we will work with Android broadcasts and use it as a mechanism to receive and send messages. We will comprehend it in several steps. First, we will explain the mechanism that lies beneath and how to use Android broadcast messages. Then, we will listen for some of the most common messages. Since it's not enough just to listen, we will create new ones and broadcast them. Finally, we will meet with boot, shutdown, and network broadcast messages, so our application is aware of this important system event.

In this chapter, we will cover the following topics:

  • Android broadcasts
  • Listening for broadcasts
  • Creating broadcasts
  • Listening for network events

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.