12

I am currently debugging an application that should auto-start after the device boots. To this end I have created a BroadcastReceiver and added it to my AndroidManifest.xml:

<receiver android:name=".receiver.StartupBroadcastReceiver">
    <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
    </intent-filter>
</receiver>

This works all of the time on most devices. On one device however (an MXQ Pro set-top box) it only works most of the time. So far, I have not been able to find any patterns in when it works and when it does not.

So, I would like to find out which BroadcastReceivers are actually, currently registered with the system to receive the BOOT_COMPLETED Intent.

I played around a bit with

  • pm: but this only tells me which packages would like to receive the Intent
  • dumpsys: but its output is overwhelming and I don't know what to look for

Thanks for any advice!

david.mihola
  • 12,062
  • 8
  • 49
  • 73
  • tried `dumpsys activity -h`? – pskink Jun 10 '16 at 11:20
  • 1
    Ah, yes, I did look at the documentation. `dumpsys activity b` seemed promising, but I can find neither my package name nor the actual `BroadcastReceiver` in there, even on devices where everything works. There are hundreds of "ReceiverLists" each with their own ID, but nothing matches the output of, for example, `dumpsys package my.package.name` either. Hence the "overwhelming". – david.mihola Jun 10 '16 at 11:55
  • 3
    i just run `dumpsys package my.package.name` and got: `Receiver Resolver Table: Non-Data Actions: android.intent.action.BOOT_COMPLETED: 52b3eee0 my.package.name/.MyReceiver filter 52b3ef68 Action: "android.intent.action.BOOT_COMPLETED"` – pskink Jun 10 '16 at 17:55

1 Answers1

23

If you just need to confirm that some specific receiver was properly registered (i.e. you care only about receivers in some specific package you know name of) then just use dumpsys package my.package.name like @pskink suggested in the comments.

But if you indeed want to know all the receivers system-wide receiving some specific intent - since Android 7.0 you can use

adb shell cmd package query-receivers --brief -a android.intent.action.BOOT_COMPLETED

Remove the --brief parameter if you want more details. And to list just the names:

adb shell cmd package query-receivers --components -a android.intent.action.BOOT_COMPLETED
Alex P.
  • 30,437
  • 17
  • 118
  • 169