3
private void requestNewCoordinates() {          

        final WifiManager wfManager = (WifiManager) context
                .getSystemService(Context.WIFI_SERVICE);
             if (manager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)
                && wfManager.isWifiEnabled()) {
             }
}

  <uses-permission android:name="android.permission.ACCESS_GPS" />
    <uses-permission android:name="android.permission.ACCESS_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <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" />

什么时候wfManager.isWifiEnabled() - java.lang.Securityexception

告诉我出了什么问题..以及如何解决问题

https://stackoverflow.com/a/9325388/1568164 - 它有效

4

3 回答 3

1

在您的清单中授予此权限

<uses-feature android:name="android.hardware.wifi" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />    
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
于 2012-09-27T12:21:00.510 回答
0

确保您已在清单文件中声明了ACCESS_NETWORK_STATE权限。

于 2012-09-27T11:55:46.150 回答
0

在清单中授予权限

<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" />
于 2012-09-27T11:59:21.867 回答