开发者

periodic check to see whether Wifi in enables in Android

开发者 https://www.devze.com 2023-01-16 14:04 出处:网络
I 开发者_StackOverflowwant to develop an application that will periodically check whether Wi-Fi is enabled in android and depending on on the result it will take an action. Can anyone give me some sug

I 开发者_StackOverflowwant to develop an application that will periodically check whether Wi-Fi is enabled in android and depending on on the result it will take an action. Can anyone give me some suggestions regarding this?

Thanks kaisar


I think you would better implement a BroadcastReceiver listening to WifiManager.NETWORK_STATE_CHANGED_ACTION system intents.

This way you don't drain battery with unnecessary system wakeup for starting your periodic service, and you are guaranteed to track all wifi state changes.

0

精彩评论

暂无评论...
验证码 换一张
取 消