Reputation: 704
I have been working on a simple soundboard app and I am having a strange issue. The app works fine when it is first installed and any time after that, its only once the device its installed on is rebooted that it begins to have issues.
Once the device is reboot the app appears to loose one of its
Specifically:
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS"/>
Here is the stake trace I see:
FATAL EXCEPTION: main
Process: com.wochstudios.soundboard, PID: 10105
java.lang.SecurityException: Permission Denial: opening provider com.android.providers.media.MediaDocumentsProvider from ProcessRecord{9f2b05a 10105:com.wochstudios.soundboard/u0a155} (pid=10105, uid=10155) requires android.permission.MANAGE_DOCUMENTS or android.permission.MANAGE_DOCUMENTS
at android.os.Parcel.readException(Parcel.java:1546)
at android.os.Parcel.readException(Parcel.java:1499)
at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:3361)
at android.app.ActivityThread.acquireProvider(ActivityThread.java:4709)
at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2611)
at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1440)
at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1063)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:921)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:848)
at com.wochstudios.soundboard.Utils.SoundPlayer.getFileDescriptorFromUri(SoundPlayer.java:55)
at com.wochstudios.soundboard.Utils.SoundPlayer.playSound(SoundPlayer.java:25)
at com.wochstudios.soundboard.Controllers.SoundboardController.playSound(SoundboardController.java:26)
at com.wochstudios.soundboard.DisplayFragments.SoundboardFragment$ListViewClickListener.onItemClick(SoundboardFragment.java:160)
at android.widget.AdapterView.performItemClick(AdapterView.java:305)
at android.widget.AbsListView.performItemClick(AbsListView.java:1146)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:3053)
at android.widget.AbsListView$3.run(AbsListView.java:3860)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:702)
I have the min and target sdk set to 19, and I've been testing using a device with API 22.
I've been banging my head against the all trying to figure this out, but haven't had any luck yet.
I've tried listing the permission twice in the manifest, updating the apps version code and name, uninstalling the app completely and reinstalling, nothing has work so far.
Any help would be greatly appreciated.
Upvotes: 0
Views: 2212
Reputation: 1006944
A Uri
that you get from another app may be short-lived, in terms of how long you can access its contents. The best analogy is a URL to a file on a Web site — if that URL requires an authenticated session, the URL will work so long as the user's session is still alive, after which the URL will no longer work, forcing the user to log in again.
If you are using the Storage Access Framework APIs on Android 4.4+ to get this Uri
, you can try to take persistable Uri
permissions, which may be offered and may allow you to access the Uri
for longer.
Upvotes: 1