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.
精彩评论