Here you can find the source of getCurrentSsid(Context context)
private static String getCurrentSsid(Context context)
//package com.java2s; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.text.TextUtils; public class Main { private static String getCurrentSsid(Context context) { String ssid = null;// w ww . jav a2 s. c o m ConnectivityManager connManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connManager .getNetworkInfo(ConnectivityManager.TYPE_WIFI); if (networkInfo.isConnected()) { final WifiManager wifiManager = (WifiManager) context .getSystemService(Context.WIFI_SERVICE); final WifiInfo connectionInfo = wifiManager.getConnectionInfo(); if (connectionInfo != null && !TextUtils.isEmpty(connectionInfo.getSSID())) { ssid = connectionInfo.getSSID(); } } return ssid; } }