Registering BOOT_COMPLETED receiver in Android 8

4ndro1d picture 4ndro1d · Aug 31, 2017 · Viewed 8.8k times · Source

We are about to update our App Android API 26. In the documentation about Broadcast receiver it says that

Apps that target Android 8.0 or higher can no longer register broadcast receivers for implicit broadcasts in their manifest

Implicit broadcast receivers are described as

a broadcast that does not target that app specifically. For example, ACTION_PACKAGE_REPLACED

So I assume that android.intent.action.BOOT_COMPLETED is considered an implicit receiver.

Further it states that implicit receivers must be registered within an Activity by using Context.registerReceiver(). But that wouldn't make sense for a receiver, which is listening for the BOOT_COMPLETED event.

What is the proper way to handle this? Can i keep this receiver in my manifest?

Answer

Frank picture Frank · Aug 31, 2017

BOOT_COMPLETED is still accepted.

https://developer.android.com/guide/components/broadcast-exceptions.html

No need to change anything. Make sure you test in Android 8.