Below permission has add in my AndroidManifest.xml

    <uses-permission
android:name="android.permission.WRITE_SECURE_SETTINGS"></uses-permission>

Bug still cause WRITE_SECURE_SETTINGS exception, why?

Log error following:

03-04 09:53:57.589: ERROR/DatabaseUtils(202): Writing exception to parcel
03-04 09:53:57.589: ERROR/DatabaseUtils(202):
java.lang.SecurityException: Permission denial: writing to secure
settings requires android.permission.WRITE_SECURE_SETTINGS
03-04 09:53:57.589: ERROR/DatabaseUtils(202):     at
com.android.providers.settings.SettingsProvider.checkWritePermissions(SettingsProvider.java:211)
03-04 09:53:57.589: ERROR/DatabaseUtils(202):     at
com.android.providers.settings.SettingsProvider.insert(SettingsProvider.java:552)
03-04 09:53:57.589: ERROR/DatabaseUtils(202):     at
android.content.ContentProvider$Transport.insert(ContentProvider.java:198)
03-04 09:53:57.589: ERROR/DatabaseUtils(202):     at
android.content.ContentProviderNative.onTransact(ContentProviderNative.java:146)
03-04 09:53:57.589: ERROR/DatabaseUtils(202):     at
android.os.Binder.execTransact(Binder.java:320)
03-04 09:53:57.589: ERROR/DatabaseUtils(202):     at
dalvik.system.NativeStart.run(Native Method)
03-04 09:53:57.589: WARN/dalvikvm(8976): threadid=1: thread exiting
with uncaught exception (group=0x40015560)
03-04 09:53:57.589: ERROR/AndroidRuntime(8976): FATAL EXCEPTION: main
03-04 09:53:57.589: ERROR/AndroidRuntime(8976):
java.lang.SecurityException: Permission denial: writing to secure
settings requires android.permission.WRITE_SECURE_SETTINGS
03-04 09:53:57.589: ERROR/AndroidRuntime(8976):     at
android.os.Parcel.readException(Parcel.java:1322)
03-04 09:53:57.589: ERROR/AndroidRuntime(8976):     at
android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:160)
03-04 09:53:57.589: ERROR/AndroidRuntime(8976):     at
android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:114)
03-04 09:53:57.589: ERROR/AndroidRuntime(8976):     at
android.content.ContentProviderProxy.insert(ContentProviderNative.java:408)
03-04 09:53:57.589: ERROR/AndroidRuntime(8976):     at
android.content.ContentResolver.insert(ContentResolver.java:604)
03-04 09:53:57.589: ERROR/AndroidRuntime(8976):     at
android.provider.Settings$NameValueTable.putString(Settings.java:575)
03-04 09:53:57.589: ERROR/AndroidRuntime(8976):     at
android.provider.Settings$Secure.putString(Settings.java:2199)
03-04 09:53:57.589: ERROR/AndroidRuntime(8976):     at
android.provider.Settings$Secure.setLocationProviderEnabled(Settings.java:3657)

(below is my code to envoke  com.android.providers.settings)
Settings.Secure.setLocationProviderEnabled(context.getContentResolver(),LocationManager.GPS_PROVIDER,
on);

03-04 09:53:57.589: ERROR/AndroidRuntime(8976):     at
com.android.clocklive.DeviceControlAdapter.enableGPS(DeviceControlAdapter.java:89)
03-04 09:53:57.589: ERROR/AndroidRuntime(8976):     at
com.android.clocklive.ClickButtonHandler.onClick(ClickButtonHandler.java:48)


03-04 09:53:57.589: ERROR/AndroidRuntime(8976):     at
android.view.View.performClick(View.java:2485)
03-04 09:53:57.589: ERROR/AndroidRuntime(8976):     at
android.widget.CompoundButton.performClick(CompoundButton.java:99)
03-04 09:53:57.589: ERROR/AndroidRuntime(8976):     at
android.view.View$PerformClick.run(View.java:9081)
03-04 09:53:57.589: ERROR/AndroidRuntime(8976):     at
android.os.Handler.handleCallback(Handler.java:603)
03-04 09:53:57.589: ERROR/AndroidRuntime(8976):     at
android.os.Handler.dispatchMessage(Handler.java:92)
03-04 09:53:57.589: ERROR/AndroidRuntime(8976):     at
android.os.Looper.loop(Looper.java:123)
03-04 09:53:57.589: ERROR/AndroidRuntime(8976):     at
android.app.ActivityThread.main(ActivityThread.java:3701)
03-04 09:53:57.589: ERROR/AndroidRuntime(8976):     at
java.lang.reflect.Method.invokeNative(Native Method)
03-04 09:53:57.589: ERROR/AndroidRuntime(8976):     at
java.lang.reflect.Method.invoke(Method.java:507)
03-04 09:53:57.589: ERROR/AndroidRuntime(8976):     at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:875)
03-04 09:53:57.589: ERROR/AndroidRuntime(8976):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:633)
03-04 09:53:57.589: ERROR/AndroidRuntime(8976):     at
dalvik.system.NativeStart.main(Native Method)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to