For the More Curious: Limitations on Broadcast Receivers

As you saw earlier in this chapter, there are limitations on broadcast receivers declared in your Android manifest that may cause your receiver to not be called. This behavior does not apply to receivers that you register dynamically using registerReceiver(…) and is only applicable when your app runs on Android Oreo (API level 26) and newer versions of Android.

The limitations on standalone broadcast receivers were introduced with the goal of improving battery life and performance on users’ devices. If a broadcast receiver is registered in your manifest and your app is not running, the system must spin up a new process whenever a broadcast needs to be delivered to this receiver. ...

Get Android Programming: The Big Nerd Ranch Guide, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.