Search code examples
broadcastreceiverandroid-wifiwifimanagerandroid-9.0-pie

How can I detect WiFi being switched on in LineageOS 16?


I previously detected WiFi being switched on and off using a BroadcastReceiver listening for WifiManager.NETWORK_STATE_CHANGED_ACTION on LineageOS 15.1/Android Oreo 8.1.

Now in LineageOS 16 this seems to only be broadcast when WiFi is switched off, not when it is switched on.

Is this now only detectable through the JobService or does anybody know another method? Thank you.


Solution

  • My mistake is described in this question and its accepted answer. So I guess it was a bug or fluke that it worked before - things are now more consistent in Pie, which is reassuring.