android - Not receiving broadcast for "wifi is connected" -
i have registered broadcastreceiver in manifest. registered
<action android:name="android.net.conn.connectivity_change" /> <action android:name="android.net.wifi.wifi_state_changed" />
i have registered following permissions:
<uses-permission android:name="android.permission.access_wifi_state" /> <uses-permission android:name="android.permission.access_network_state"/>
it fires when disable/enable wifi , when wifi disconnected after losing signal (when go away hotspot). there no broadcast when came hotspot (when wifi connected again). have testet samsung galaxy s5 (android 6.0.1). there peculiarity don't know?
the code broadcastreceiver
public class statusreceiver extends broadcastreceiver { @override public void onreceive(final context context, intent intent) { if(intent.getaction() != null) log.d("action", intent.getaction()); } } <receiver android:name=".receivers.statusreceiver"> <intent-filter> <action android:name="android.net.conn.connectivity_change" /> <action android:name="android.net.wifi.wifi_state_changed" /> </intent-filter> </receiver>
there android.net.conn.connectivity_change
when leave network. , android.net.wifi.wifi_state_changed
when toggle wifi button.
but no broadcast when returning hotspot or when wifi connected after enabling wifi
the smart manager (how f... get rid of this?) had blocked broadcasts save energy. put "disabled" list , works charm..
Comments
Post a Comment