I need to check the current connected wifi SSID on android. I checked with Nokia 6 and OnePlus 5 with respectively Oreo 8.1.0 and Oreo 8.0. Other phones with different OS v
In Android Oreo you could use ConnectivityManager
to know your wifi SSID.
Permission
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
Code to get SSID
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = cm.getActiveNetworkInfo();
if (info != null && info.isConnected()) {
String ssid = info.getExtraInfo();
Log.d(TAG, "WiFi SSID: " + ssid);
}
This is tested in Android Oreo 8.1.0. You will get SSID enclosed with double quotes.