I am developing an android service at OS level. ( not from SDK, its from android source code. It will be part of my custom ROM. I can tun myself as root)
I am going to give an interface to apps to do something using my custom intent. At the end I want to know who all are listening for this intent.
Is there any way to get list of all BroadcastReceiver(s) registered for a specific intent?
Thanks for help!
public boolean isReceiverRegistered(BroadcastReceiver receiver); It would return true if it's registered and false if not.
Creating a BroadcastReceiverThe intent object is passed with all the additional data. A Context object is also available and is used to start an activity or service using context. startActivity(myIntent); or context.
Retrieve the current result data, as set by the previous receiver. Retrieve the current result extra data, as set by the previous receiver. This can be called by an application in onReceive(Context, Intent) to allow it to keep the broadcast active after returning from that function.
A simple solution to this problem is to call the registerReceiver() in your Custom Application Class. This will ensure that your Broadcast receiver will be called only one in your entire Application lifecycle.
From a program you can use PackageManager
and queryBroadcastReceivers()
.
From the 'adb shell', try the command: dumpsys activity
the Activity Resolver Table lists all the things that broadcast receivers are looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With