BroadcastReceiver

This is where you get to learn about the BroadcastReceiver class. According to the official documentation, it is the base class for code that receives and handles broadcast intents sent by sendBroadcast(Intent).

Basically, it is responsible for receiving broadcast events in your app. There are two ways of registering this receiver:

  • Dynamically, using an instance of this class with Context.registerReceiver(), or
  • Statically, using the <receiver> tag in your AndroidManifest.xml

An important note from the documentation:
Beginning with Android 8.0 (API level 26), the system imposes additional restrictions on manifest-declared receivers. If your app targets API level 26 or higher, you cannot use the manifest to declare a receiver for most implicit broadcasts (broadcasts that do not target your app specifically).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset