How to get name of wifi-network out of android using android API?

Viewed 53993

I thought that I should use NetworkInterface::getDisplayName. I got some name, but this name is different that this name which I can see, when I choosing to which network I want to connect.

4 Answers

Simple as 2 lines

WifiManager w=(WifiManager)getSystemService(Context.WIFI_SERVICE);
String wifi=w.getConnectionInfo().getSSID();

Remember to put this in your Manifest

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
Related