我已使用以下代码启用gps切换
Settings.Secure.setLocationProviderEnabled(getContentResolver(), LocationManager.GPS_PROVIDER, true);
OR
Settings.Secure.putString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, LocationManager.GPS_PROVIDER);
但是抛出异常:java.lang.SecurityException:权限拒绝:写入安全设置
但我已经在androidManifestFile中设置了权限
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
所以Plz帮助我......
答案 0 :(得分:0)