开发者

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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜