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 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.