Android: How to Enable/Disable Wifi or Internet Connection Programmatically

I know of enabling or disabling wifi: WifiManager wifiManager = (WifiManager)this.context.getSystemService(Context.WIFI_SERVICE); wifiManager.setWifiEnabled(status); where status may be true or false as per requirement. Edit: You also need the following permissions in your manifest file: <uses-permission android:name=”android.permission.ACCESS_WIFI_STATE”/> <uses-permission android:name=”android.permission.CHANGE_WIFI_STATE”/>

Adding a new network bearer to Android

WIFI add network will be you can take hints from this code.. how do we get the access point name from an Android Phone. WifiManager mWiFiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE); WifiInfo w = mWiFiManager.getConnectionInfo(); Toast.makeText(this, “APN Name = “+w.getSSID(), Toast.LENGTH_SHORT).show(); The above code snippet is for current active APN name.

How to programmatically create and read WEP/EAP WiFi configurations in Android?

Part 1: Creating a WEP WiFi configuration programmatically This is pretty much straightforward, WifiConfiguration exposes the interface to create the same. Here is the sample code: void saveWepConfig() { WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); WifiConfiguration wc = new WifiConfiguration(); wc.SSID = “\”SSID_NAME\””; //IMP! This should be in Quotes!! wc.hiddenSSID = true; wc.status = WifiConfiguration.Status.DISABLED; wc.priority … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)