Hai is it possible to check the broadcast receiver is currently running or not?if possible how to check it?
You can use dumpsys to help debug this for dynamically registered receivers:
adb shell dumpsys activity broadcasts
Use this in combination with grep and breakpoints in the debugger and you can find if your broadcast is registered at a certain time or not.
This is supposed to help with statically registered receivers, but I haven't used it myself:
adb shell dumpsys package
If you want to check it at runtime you can store a global boolean
variable and set it to false
and inside your onReceive()
set it to true
and before the onReceive()
exit set it back to false .
any time you can check this global variable to tell if that broadcast receiver is running or not .
if you mean you want to know if its work or not make a message to the log cat example
onReceive(){
Log.d("my broadcast","works");
}
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