Skip to content Skip to sidebar Skip to footer

How To Add Wi-fi Option In Gprs Spinner

In my application i am using 'apn' for GPRS connection display. I code a spinner in which i get the Telenor GPRS, Telenor MMS and Telenor WAP. **I want to add Wi-Fi option in this

Solution 1:

I assume that this is for a Gingerbread Device as Setting the Default APN was removed in ICS (4.0 - API 14), deprecated.

Have you tried adding in:

wifiManager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE); 
wifiManager.setWifiEnabled(true);

You will need to add these permissions to your Android Manifest:

<uses-permissionandroid:name="android.permission.ACCESS_WIFI_STATE"></uses-permission><uses-permissionandroid:name="android.permission.UPDATE_DEVICE_STATS"></uses-permission><uses-permissionandroid:name="android.permission.CHANGE_WIFI_STATE"></uses-permission>

You can also have an additional Spinner come up to have the User select from available Wifi spots by using Scan Result: http://developer.android.com/reference/android/net/wifi/ScanResult.html

and then

WifiManager: http://developer.android.com/reference/android/net/wifi/WifiManager.html

to set the Desired Network if there is not a default connection in place.

Markana has a nice tutorial on using Wifi this way: http://marakana.com/forums/android/examples/40.html

Post a Comment for "How To Add Wi-fi Option In Gprs Spinner"