1

I am developing and app for a restaurant. They want their customers to connect their Wifi via app.

The code:

WifiManager mManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
WifiConfiguration config = new WifiConfiguration();
//Asume I added things to config.
int id = mManager.addNetwork(config);
mManager.enableNetwork(id, true);

So even if I don't call

myManager.saveConfiguration();

can the device connect that Router without my app?

Thank you for your time.

Ozgur Bagci
  • 768
  • 11
  • 25

1 Answers1

0

OK! I read about it more and more, I found the answer. And also the solution.

So, you need to use use

mManager.removeNetwork(id);

after it is disconnected. I assume you saved your BSSID's in somewhere. Also save the ID that you got. With a Timer task working at background check the current BSSID, if it is not the same, remove the ID from Configured Networks as above.

Here is how you check current BSSID:

 WifiInfo wifiInfo = mManager.getConnectionInfo();
 String currentBSSID = wifiInfo.getBSSID();
Community
  • 1
  • 1
Ozgur Bagci
  • 768
  • 11
  • 25