Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid improperly forgets wireless networks
    primarykey
    data
    text
    <p>I've written an application to easily connect Android devices to our company's various wireless networks. It is intended to be run once, when the device is unboxed and set up with the rest of our application suite.</p> <p>The problem is that sometimes, the device will forget the networks without being told to do so. I have not been able to reproduce this, unfortunately. I'm hoping that I've missed some API call that the Android gurus here can help me find.</p> <p>The code that follows is from my run-once wireless initialization app, with the network names and keys changed. Can anyone see something I'm doing incorrectly here?</p> <p>Edit: The device that I have observed this behavior on is the LG Ally. I'm hoping it's a bug with my own code, so that's where I'm starting.</p> <pre><code>@Override public void onCreate(Bundle savedInstanceState) { WifiConfiguration n1Config = new WifiConfiguration(); n1Config.SSID = "\"networkOne\""; n1Config.preSharedKey = "\"...\""; n1Config.status = WifiConfiguration.Status.ENABLED; WifiConfiguration n2Config = new WifiConfiguration(); n2Config.SSID = "\"networkTwo\""; n2Config.hiddenSSID = true; n2Config.wepKeys[0] = "..."; n2Config.wepTxKeyIndex = 0; n2Config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); n2Config.allowedProtocols.set(WifiConfiguration.Protocol.RSN); n2Config.allowedProtocols.set(WifiConfiguration.Protocol.WPA); n2Config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN); n2Config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED); n2Config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP); n2Config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP); n2Config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40); n2Config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104); n2Config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP); n2Config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP); n2Config.status = WifiConfiguration.Status.ENABLED; WifiManager wifiManager = (WifiManager)getSystemService(Context.WIFI_SERVICE); int n1ID = wifiManager.addNetwork(n1Config); wifiManager.enableNetwork(n1ID, false); int n2ID = wifiManager.addNetwork(n2Config); wifiManager.enableNetwork(n2ID, false); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload