简体   繁体   中英

Is there any way to keep WIFI always ON, ignoring even the Power mode set by the user?

I am making an android app which requires WIFI to be always ON even if phone gets locked. Also, power mode selected by user shouldn't make WIFI to turn OFF. For example, if user selects "Power Saving" mode than OS will automatically turn OFF the WIFI which I want to ignore & just keep it ON forever?

Is it achievable?

The only thing that you can do is use WifiLock . This keeps the WiFi radio on when it was already on. However:

  • It does not override manual user control (eg, airplane mode)

  • AFAIK it will not change full Doze behavior, where network access is suspended (though the user could add your app to the battery optimization whitelist)

  • Some device manufacturers have added more aggressive power management features, and it is possible that WifiLock is ignored for them

  • Users may get irritated if they feel that you are using an excessive amount of power, and users can express their irritation in a variety of ways, few of which are pleasant

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM