android turning on wifi programmatically

你说的曾经没有我的故事 提交于 2019-11-28 07:01:49

You need to create wifiLock with wifi mode_full, a bit strange name for that method but doing the work.

Raghu Nagaraju

You can turn on/off wifi using following instructions :

WifiManager wManager = (WifiManager)this.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
wManager.setWifiEnabled(booleanValue); //true or false

Set following permissions to your manifest:

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.UPDATE_DEVICE_STATS"></uses-permission>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE">
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!