Reputation: 2231
I am writing an application related to location. Nevertheless, I need to turn on the Wifi/3G and GPS in case it is off before other functions can process. I have searched but I did not see any way to auto turn on 3g/wifi and GPS. How to start this functionality by coding ?
Upvotes: 0
Views: 11176
Reputation: 1
If you are finding any difficulties in turning on 3G on your Android device then follow the below steps.
Now if you are in 3G-enabled area and your device is 3G compatible, you are good to enjoy high speed internet services on your mobile phone.
Upvotes: 0
Reputation: 29672
Following Code is use to start Wifi programatically.
WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
wifi.setWifiEnabled(enabled);
You need to add following permission in to your AndroidManifest.xml
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
Upvotes: 1