我使用过Android示例,我的设置页面为RingtonePreference
在示例中,它将首选项绑定到侦听器,该侦听器在首选项更改时设置摘要以反映用户选择
最近LG G2用户报告了他的设备发生了故障
发生的事情是默认铃声驻留在外部存储中,在调用getTitle()
时导致SecurityException:
Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/audio/media/60 from pid=20754, uid=10127 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
整个回溯:
at android.os.Parcel.readException(Parcel.java:1540)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:420)
at android.content.ContentResolver.query(ContentResolver.java:485)
at android.content.ContentResolver.query(ContentResolver.java:429)
at com.lge.media.RingtoneManagerEx.getActualDefaultRingtoneUri(RingtoneManagerEx.java:244)
at android.media.RingtoneEx.getTitle(RingtoneEx.java:177)
at android.media.RingtoneEx.getTitle(RingtoneEx.java:145)
at com.package.name.SettingsActivity$1.onPreferenceChange(SettingsActivity.java:77)
at com.package.name.SettingsActivity.bindPreferenceSummaryToValue(SettingsActivity.java:115)
at com.package.name.SettingsActivity.access$000(SettingsActivity.java:38)
at com.package.name.SettingsActivity$NotificationPreferenceFragment.onCreate(SettingsActivity.java:235
我应该要求READ_EXTERNAL_STORAGE
许可吗?
还有另外一种方法吗?
我尝试从设备上的外部存储器中选择一个铃声(S7)并且它工作得很好,我不需要任何许可,为什么它会在LG设备上引发异常?