我收到有关缺少 CHANGE_WIFI_STATE 权限的错误的用户报告:
错误:
java.lang.SecurityException: WifiService: Neither user 10137 nor current process has android.permission.CHANGE_WIFI_STATE.
at android.net.wifi.WifiManager.getConnectionInfo(WifiManager.java:642)
这是代码块:
WifiManager wifiMan = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
if (wifiMan != null) {
WifiInfo wifiInfo = wifiMan.getConnectionInfo();
我认为这只需要 ACCESS_WIFI_STATE,因为我没有对 wifi 进行任何启用/禁用?无法在测试中复制。