Android 获取WIFI 名称

 获取WiFi 名称方法:

WifiManager wifiMgr = (WifiManager) activity.getSystemService(Context.WIFI_SERVICE);

int wifiState = wifiMgr.getWifiState();     
WifiInfo info = wifiMgr.getConnectionInfo();
String wifiId = info != null ? info.getSSID() : null;

去除WiFI名称两边“号:

String name = wifiInfo.getSSID().replace("\"", "");

 

你可能感兴趣的:(Android 获取WIFI 名称)