Android2.2 to enable/disable gps toggle programatically
I have used the code below to enable the gps toggle
Settings.Secure.setLocationProviderEnabled(getContentResolver(), LocationManager.GPS_PROVIDER, true);
OR
Settings.Secure.putString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOW开发者_Go百科ED, LocationManager.GPS_PROVIDER);
but is throw exception :java.lang.SecurityException:permission denial: writing to secure settings
but i have already set the permission in androidManifestFile
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
So Plz help me......
please refer to this page:
http://groups.google.com/group/android-developers/browse_thread/thread/483cb94fe113db5f
精彩评论