开发者

How to get WIFI to turn on during POWERUP?

开发者 https://www.devze.com 2023-03-02 07:17 出处:网络
For a long time my device would always auto start WIFI now it does not.Could someo开发者_开发问答ne show how to turn wifi on automatically when device boots?Also if my app sleeps sometimes on recovery

For a long time my device would always auto start WIFI now it does not. Could someo开发者_开发问答ne show how to turn wifi on automatically when device boots? Also if my app sleeps sometimes on recovery wifi is gone? Show how to test if wifi is active and if not active how to turn it on programatically. Thanks


Use wifi manager class and use the following code to test wifi connectivity

WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);

if(wifi.isWifiEnabled()) { // write your code }else{ wifi.setWifiEnabled(true); }

0

精彩评论

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