Sending broadcasts

Android has the following three ways of sending broadcast messages:

  • Using the sendOrderedBroadcast(Intent, String) method sends messages to one receiver at a time. Since receivers execute in order, it's possible to propagate a result to the next receiver. Also, it's possible to abort the broadcast so that it won't be passed to the rest of the receivers. We can control the order in which receivers are executed. We can use the android:priority attribute of the matching intent filter to prioritize.
  • Using the sendBroadcast(Intent) method sends broadcast messages to all receivers. The sending is not ordered.
  • Using the LocalBroadcastManager.sendBroadcast(Intent) method sends broadcasts to receivers that are in the same application ...

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.