Android AP模式下获取SSID/PASSWORD(反射机制)
1.test.java文件
WifiManager mWifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
WifiConfiguration mWifiConfig = mWifiManager.getWifiApConfiguration();
WifiInfo wifiInfo = mWifiManager.getConnectionInfo();
Log.i(TAG, "AP SSID :" + mWifiConfig.SSID + "AP password : " + mWifiConfig.preSharedKey);
2.权限
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />