Android examples for android.net.wifi:Wifi SSID
get Current SSID from WifiManager
import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.wifi.WifiManager; public class Main { public static String getCurrentSSID(final Context context) { String ssid = null;/*ww w.ja v a 2s . c o m*/ if (isOnWiFi(context)) { WifiManager wifi = (WifiManager) context.getSystemService(android.content.Context.WIFI_SERVICE); ssid = wifi.getConnectionInfo().getSSID(); if (ssid != null) { ssid = ssid.replaceAll("\"", ""); } } return ssid; } public static boolean isOnWiFi(final Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo ni = cm.getActiveNetworkInfo(); if (ni == null || !ni.isConnected() || (ni.getType() != ConnectivityManager.TYPE_WIFI)) { return false; } return true; } }