Is an android app that scans a specific qr code and connects to a wifi that is associated with the qr
private void connectTo(String SSID, String password)
{
WifiConfiguration wifiConfig = new WifiConfiguration();
wifiConfig.SSID = String.format("\"%s\"", SSID);
wifiConfig.preSharedKey = String.format("\"%s\"", password);
WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
// remember id
int netId = wifiManager.addNetwork(wifiConfig);
wifiManager.disconnect();
wifiManager.enableNetwork(netId, true);
wifiManager.reconnect();
// WifiManager wifiManager = (WifiManager)
// getSystemService(Context.WIFI_SERVICE);
}
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
switch (requestCode) {
case ZBAR_SCANNER_REQUEST:
case ZBAR_QR_SCANNER_REQUEST:
if (resultCode == RESULT_OK) {
String x = data.getStringExtra(ZBarConstants.SCAN_RESULT);
networkSSID = getS.getSSID(x);
...}
<ssid>networkSSID</ssid>
<pass>password</pass>