Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: How to create EAP wifi configuration programmatically?
    text
    copied!<p>I know how to create Open/WEP/PSK/PSK2 configuration programmatically.</p> <p>ex.</p> <pre><code>WifiConfiguration conf = new WifiConfiguration(); conf.SSID = "ssid"; conf.preSharedKey = "\"password\""; conf.status = WifiConfiguration.Status.ENABLED; conf.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN); conf.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40); conf.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104); conf.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP); conf.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP); conf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); conf.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP); conf.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP); conf.allowedProtocols.set(WifiConfiguration.Protocol.WPA); conf.allowedProtocols.set(WifiConfiguration.Protocol.RSN); int res = wifi.addNetwork(conf); boolean b = wifi.enableNetwork(res, true); </code></pre> <p>But how do I create one for '802.1x EAP'? Looking into the source code at: ..\packages\apps\Settings\src\com\android\settings\wifi\WifiDialog.java</p> <pre><code>case AccessPoint.SECURITY_EAP: config.allowedKeyManagement.set(KeyMgmt.WPA_EAP); config.allowedKeyManagement.set(KeyMgmt.IEEE8021X); config.eap.setValue((String) mEapMethod.getSelectedItem()); config.phase2.setValue((mPhase2.getSelectedItemPosition() == 0) ? "" : "auth=" + mPhase2.getSelectedItem()); config.ca_cert.setValue((mEapCaCert.getSelectedItemPosition() == 0) ? "" : KEYSTORE_SPACE + Credentials.CA_CERTIFICATE + (String) mEapCaCert.getSelectedItem()); config.client_cert.setValue((mEapUserCert.getSelectedItemPosition() == 0) ? "" : KEYSTORE_SPACE + Credentials.USER_CERTIFICATE + (String) mEapUserCert.getSelectedItem()); config.private_key.setValue((mEapUserCert.getSelectedItemPosition() == 0) ? "" : KEYSTORE_SPACE + Credentials.USER_PRIVATE_KEY + (String) mEapUserCert.getSelectedItem()); config.identity.setValue((mEapIdentity.length() == 0) ? "" : mEapIdentity.getText().toString()); config.anonymous_identity.setValue((mEapAnonymous.length() == 0) ? "" : mEapAnonymous.getText().toString()); if (mPassword.length() != 0) { config.password.setValue(mPassword.getText().toString()); } </code></pre> <p>Seems to do the work but 'config.eap' is not accessable from my application.</p> <p>Is there a way to configure EAP types or is it not possible?</p>
 

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