我的开发者控制台中出现错误,它表示无法启动RingTonePickerActivity
,因为我在清单中没有WRITE_SETTINGS
权限。为什么我需要该权限才能显示RingTonePicker
?我在几个设备上测试了这个,而没有清单中的那个并且根本没有问题,所以给出了什么?
java.lang.RuntimeException: Unable to start activity ComponentInfo{android/com.android.internal.app.RingtonePickerActivity}:
java.lang.SecurityException: Permission Denial: writing com.android.providers.settings.SettingsProvider uri content://settings/system from pid=24760, uid=10108 requires android.permission.WRITE_SETTINGS
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.SecurityException: Permission Denial: writing com.android.providers.settings.SettingsProvider uri content://settings/system from pid=24760, uid=10108 requires android.permission.WRITE_SETTINGS
at android.os.Parcel.readException(Parcel.java:1322)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:160)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:114)
at android.content.ContentProviderProxy.insert(ContentProviderNative.java:408)
at android.content.ContentResolver.insert(ContentResolver.java:604)
at android.provider.Settings$NameValueTable.putString(Settings.java:576)
at android.provider.Settings$System.putString(Settings.java:772)
at android.media.RingtoneManager.setActualDefaultRingtoneUri(RingtoneManager.java:655)
at android.media.RingtoneManager.setDefaultNotificationToProvider(RingtoneManager.java:764)
at com.android.internal.app.RingtonePickerActivity.onCreate(RingtonePickerActivity.java:166)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
答案 0 :(得分:0)
public static final String WRITE_SETTINGS
自:API Level 1
允许应用程序读取或写入系统设置。不变 值:“android.permission.WRITE_SETTINGS”
也许您需要获得阅读系统铃声设置的权限。