How To Enable Mobile Data Or Wifi Without Going To Wireless Settings Page
I am able to determine users network avaibility and if it is not available I show a dialog telling them to go to settings to enable internet. startActivity(new Intent(Settings.ACTI
Solution 1:
WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
wifi.setWifiEnabled(false);//Turn off Wifi
wifi.setWifiEnabled(true);//Turn on Wifi
should Work and dot forgot to add below permission
.
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.UPDATE_DEVICE_STATS" />
Post a Comment for "How To Enable Mobile Data Or Wifi Without Going To Wireless Settings Page"