开发者

Android2.2 to enable/disable gps toggle programatically

开发者 https://www.devze.com 2023-02-21 05:41 出处:网络
I have used the code below to enable the gps toggle Settings.Secure.setLocationProviderEnabled(getContentResolver(), LocationManager.GPS_PROVIDER, true);

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

0

精彩评论

暂无评论...
验证码 换一张
取 消