Java tutorial
//package com.java2s; import android.content.Context; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; public class Main { /** * Returns SSID of Wifi hotspot device connected with. * @param context * @return */ public static String getCurrentWifiConnectionSSID(Context context) { final WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); final WifiInfo wifiInfo = wifiManager.getConnectionInfo(); if (wifiInfo == null) return null; String ssid = wifiInfo.getSSID(); if (android.os.Build.VERSION.SDK_INT >= 16) { if (ssid.startsWith("\"") && ssid.endsWith("\"")) { ssid = ssid.substring(1, ssid.length() - 1); } } return ssid; } }