标签:wifi
首先AndroidMainfest.xml文件中添加权限:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- 获取WIFI信息状态的权限 --> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 获取网络状态改变的权限 -->然后再activity中添加如下代码:
private String getConnectWifiSsid(){ WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE); WifiInfo wifiInfo = wifiManager.getConnectionInfo(); Log.d("wifiInfo", wifiInfo.toString()); Log.d("SSID",wifiInfo.getSSID()); return wifiInfo.getSSID(); }
Android获取当前连接的wifi名称,布布扣,bubuko.com
标签:wifi
原文地址:http://blog.csdn.net/a358763471/article/details/38537749