How to get my wifi hotspot ssid in my current android system

solar picture solar · Sep 29, 2011 · Viewed 49.6k times · Source

I have a problem that I couldn't find my wifi hotspot ssid in my Android system.
I found many information from google, but nothing helpful.
Please help me to solve it.

Answer

Lalit Poptani picture Lalit Poptani · Sep 29, 2011

You can use WifiManager and WifiInfo for getting Wifi SSID

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

Also add Permission in your Manifest file.

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