1

I want to learn the connected wif-fi point SSID. By doing so, I will not try to connect to the same point. How can I learn SSID of that I am connected to wifi point ? Is there a method like isConnected() ?

mavzey
  • 379
  • 1
  • 5
  • 13

2 Answers2

1
   WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
   WifiInfo wifiInfo = wifiManager.getConnectionInfo();
   Log.d("wifiInfo", wifiInfo.toString());
   Log.d("SSID",wifiInfo.getSSID());

you will need the android.permission.ACCESS_WIFI_STATE in your manifest

Sebastian Breit
  • 6,137
  • 1
  • 35
  • 53
0

There is one problem: I selected wifi "XYZ" whoz pwd was unknwn. Entered some random pwd. It shows authentication problem. on wifi screen.

But, Log.d("SSID",wifiInfo.getSSID()); Results into "XYZ"

user1482641
  • 103
  • 1
  • 8