question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ringtone permissions

See original GitHub issue
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.liveultrahealthy.violet/com.liveultrahealthy.violet.ui.settings.SettingsActivity}: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/audio/media/50 from pid=19062, uid=10187 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
       at android.os.Parcel.readException(Parcel.java:1546)
       at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185)
       at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)
       at android.content.ContentProviderProxy.query(ContentProviderNative.java:421)
       at android.content.ContentResolver.query(ContentResolver.java:513)
       at android.content.ContentResolver.query(ContentResolver.java:448)
       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.liveultrahealthy.violet.ui.settings.SettingsFragment$1.onPreferenceChange(SettingsFragment.java:65)
       at com.liveultrahealthy.violet.ui.settings.SettingsFragment.bindPreferenceSummaryToValue(SettingsFragment.java:80)
       at com.liveultrahealthy.violet.ui.settings.SettingsFragment.onCreatePreferences2(SettingsFragment.java:152)
       at android.support.v7.preference.XpPreferenceFragment.onCreatePreferences(XpPreferenceFragment.java:53)
       at android.support.v7.preference.PreferenceFragmentCompat.onCreate(PreferenceFragmentCompat.java:216)
       at com.liveultrahealthy.violet.ui.settings.SettingsFragment.onCreate(SettingsFragment.java:102)
...

Device: LG H634 Android 5.1.1

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
consp1racycommented, Sep 21, 2017

Yeah, me too, just about yesterday I grew tired of it and just wrapped the Ringtone.getTitle call in try-catch and just set the summary to "???" if it fails.

Here’s what I found out:

  1. This will happen when the user has a default ringtone from external storage and the app is not granted the READ_EXTERNAL_STORAGE permission. Those are apps that do not specify it in their manifest below API 23 and apps over API 23 that have not been granted the runtime permission.
  2. For devices with API <23 just request the permission in manifest. It will solve you a lot of headaches, not just this one. For example Samsung Gallery doesn’t grant you URI permissions when obtaining images, so you have to rely on the manifest permission anyway to actually read the image.
  3. On API 23+ there are two cases: a) The user has granted you READ_EXTERNAL_STORAGE permission, set a ringtone from external storage and then revoked the permission. You can work around this one by also saving the ringtone title when it’s picked. b) The user hasn’t granted you the runtime permission yet so you have no means of getting the ringtone title. And you don’t want to flash the Permission dialog for no apparent reason. This one really is a bitch.
0reactions
consp1racycommented, Oct 4, 2017

@dirkam Please update to 1.3.1. There was a NullPointerException possibility in 1.3.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solved: can't add ringtones - Samsung Community - 1165736
If I go to Settings --> sounds and vibrations --> ringtone--> ... App Settings it has Permissions "no Permissions allowed". and I can't ......
Read more >
Permissions on Zedge
In order to use wallpapers or ringtones on your phone they have to be saved somewhere. Granting permission to Zedge to access your...
Read more >
Change app permissions on your Android phone - Google Help
Change permissions based on their type · On your phone, open the settings app. · Tap Privacy And then Permission manager. · Tap...
Read more >
Q: Permission for set a ringtone; "csrutil disable" does not help
I want to set a custom ringtone (facetime), but first I should move ... the file into that folder, and I cant modify...
Read more >
android - Setting a custom ringtone without explicit permission ...
You must have to use android.permission.WRITE_SETTINGS in your code and ask user to explicitly grant this permission to make your code/application work.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found