Add private API support to the SDK
Https://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-2-hacking-around/
Required Permissions
Android. Permission. access_wifi_stateandroid.permission.change_wifi_state
Code
Wifimanager manager = (wifimanager) getsystemservice (context. wifi_service); manager. asyncconnect (this, new handler (); If (! Manager. iswifienabled () return; List <wificonfiguration> configurationlist = manager. getconfigurednetworks (); wificonfiguration configuration = NULL; int cur = manager. getconnectioninfo (). getnetworkid (); For (INT I = 0; I <configurationlist. size (); ++ I) {wificonfiguration = configurationlist. get (I); If (wificonfiguration. networkid = cur) configuration = wificonfiguration;} If (configuration = NULL) return; wificonfiguration Config = new wificonfiguration (configuration); config. ipassignment = wificonfiguration. ipassignment. unassigned; config. proxysettings = wificonfiguration. proxysettings. static; config. linkproperties. clear (); config. linkproperties. sethttpproxy (New proxyproperties ("127.0.0.1", 3128, ""); manager. savenetwork (config );