I registered with ConnectivityManager.CONNECTIVITY_ACTION BroadcastReceiver to receive network status events, but my onReceive function onReceive not called when my Wi-Fi connection is turned on or off.
As mentioned in the docs, this is a Sticky Broadcast Receiver that starts when we register for it.
But I do not receive any events in my onReceive function when I register this receiver, what could be the reason?
In my manifest file, I have all permissions to access Internet / Network / Wifi connections and their states.
I register with this intention using the following code:
registerReceiver(mNetworkStateReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
In my Logcat, I get the following error message register for this broadcast receiver:
01-01 00:05:29.804: ERROR/WifiHW(1305): Unable to open connection to supplicant on "/data/system/wpa_supplicant/wlan0": Connection refused
What could be the reason? Is there a way to find out if BroadcastReceiver is registered correctly or not?
Thanks.
source share