External Storage Permission is gone after app restart #124

Closed
opened 2026-04-24 23:08:38 +02:00 by adam · 9 comments
Owner

Originally created by @Sacerdoss on GitHub (May 7, 2022).

Steps to reproduce

  1. Download an audiobook and select/create a local media folder (grant storage permission)
  2. Audiobook downloads and displays/plays fine while the app is opened
  3. Close the app and restart.

Expected behaviour

  • Local Audiobooks in previously created library still playable

Actual behaviour

  • Local Audiobook cannot be played
  • Cover Image is not displaying anymore

Logcat when I try to issue a scan on the previously created media folder:

05-07 20:36:33.744 30266 10653 D AbsFileSystem: Scan Folder cHJpbWFyeTpNdXNpYy9Iw7ZyYsO8Y2hlcg==
05-07 20:36:33.744 30266 10653 D AbsFileSystem:  | Force Audio Probe false
05-07 20:36:33.750  9588  9605 E DatabaseUtils: Writing exception to parcel
05-07 20:36:33.750  9588  9605 E DatabaseUtils: java.lang.SecurityException: Permission Denial: reading com.android.externalstorage.ExternalStorageProvider uri content://com.android.externalstorage.documents/tree/primary%3AMusic%2FH%C3%B6rb%C3%BCcher/document/primary%3AMusic%2FH%C3%B6rb%C3%BCcher from pid=30266, uid=10323 requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs
05-07 20:36:33.750  9588  9605 E DatabaseUtils:         at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:820)
05-07 20:36:33.750  9588  9605 E DatabaseUtils:         at com.android.externalstorage.ExternalStorageProvider.enforceReadPermissionInner(ExternalStorageProvider.java:147)
05-07 20:36:33.750  9588  9605 E DatabaseUtils:         at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:684)
05-07 20:36:33.750  9588  9605 E DatabaseUtils:         at android.content.ContentProvider$Transport.query(ContentProvider.java:239)
05-07 20:36:33.750  9588  9605 E DatabaseUtils:         at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:106)
05-07 20:36:33.750  9588  9605 E DatabaseUtils:         at android.os.Binder.execTransactInternal(Binder.java:1154)
05-07 20:36:33.750  9588  9605 E DatabaseUtils:         at android.os.Binder.execTransact(Binder.java:1123)
05-07 20:36:33.750 30266 10653 W DocumentFile: Failed query: java.lang.SecurityException: Permission Denial: reading com.android.externalstorage.ExternalStorageProvider uri content://com.android.externalstorage.documents/tree/primary%3AMusic%2FH%C3%B6rb%C3%BCcher/document/primary%3AMusic%2FH%C3%B6rb%C3%BCcher from pid=30266, uid=10323 requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs
05-07 20:36:33.751 30266 10653 D FolderScanner: Folder $Hörbücher scan Results: 0 Added | 0 Updated | 0 Removed | 0 Up-to-date
05-07 20:36:33.751 30266 10653 D FolderScanner: No Media Items to save
05-07 20:36:33.751 30266 10653 D AbsFileSystem: Scan DATA {"itemsAdded":0,"itemsUpdated":0,"itemsRemoved":0,"itemsUpToDate":0,"localFolder":{"id":"cHJpbWFyeTpNdXNpYy9Iw7ZyYsO8Y2hlcg==\n","name":"Hörbücher","contentUrl":"content://com.android.externalstorage.documents/tree/primary%3AMusic%2FH%C3%B6rb%C3%BCcher/document/primary%3AMusic%2FH%C3%B6rb%C3%BCcher","basePath":"Music/Hörbücher","absolutePath":"/storage/emulated/0/Music/Hörbücher","simplePath":"primary:Music/Hörbücher","storageType":"EXTERNAL","mediaType":"book"},"localLibraryItems":[]}

Environment data

Audiobookshelf Version: Android App (0.9.44-beta), Server (2.0.11)

  • Android App?
  • iOS App?

Android Issue

Android version: 11

Device model: Galaxy S10

Stock or customized system: Lineage OS 18.1

iOS Issue

iOS Version:

iPhone model:

Originally created by @Sacerdoss on GitHub (May 7, 2022). ### Steps to reproduce 1. Download an audiobook and select/create a local media folder (grant storage permission) 2. Audiobook downloads and displays/plays fine while the app is opened 3. Close the app and restart. ### Expected behaviour - Local Audiobooks in previously created library still playable ### Actual behaviour - Local Audiobook cannot be played - Cover Image is not displaying anymore Logcat when I try to issue a scan on the previously created media folder: ```logcat 05-07 20:36:33.744 30266 10653 D AbsFileSystem: Scan Folder cHJpbWFyeTpNdXNpYy9Iw7ZyYsO8Y2hlcg== 05-07 20:36:33.744 30266 10653 D AbsFileSystem: | Force Audio Probe false 05-07 20:36:33.750 9588 9605 E DatabaseUtils: Writing exception to parcel 05-07 20:36:33.750 9588 9605 E DatabaseUtils: java.lang.SecurityException: Permission Denial: reading com.android.externalstorage.ExternalStorageProvider uri content://com.android.externalstorage.documents/tree/primary%3AMusic%2FH%C3%B6rb%C3%BCcher/document/primary%3AMusic%2FH%C3%B6rb%C3%BCcher from pid=30266, uid=10323 requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs 05-07 20:36:33.750 9588 9605 E DatabaseUtils: at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:820) 05-07 20:36:33.750 9588 9605 E DatabaseUtils: at com.android.externalstorage.ExternalStorageProvider.enforceReadPermissionInner(ExternalStorageProvider.java:147) 05-07 20:36:33.750 9588 9605 E DatabaseUtils: at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:684) 05-07 20:36:33.750 9588 9605 E DatabaseUtils: at android.content.ContentProvider$Transport.query(ContentProvider.java:239) 05-07 20:36:33.750 9588 9605 E DatabaseUtils: at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:106) 05-07 20:36:33.750 9588 9605 E DatabaseUtils: at android.os.Binder.execTransactInternal(Binder.java:1154) 05-07 20:36:33.750 9588 9605 E DatabaseUtils: at android.os.Binder.execTransact(Binder.java:1123) 05-07 20:36:33.750 30266 10653 W DocumentFile: Failed query: java.lang.SecurityException: Permission Denial: reading com.android.externalstorage.ExternalStorageProvider uri content://com.android.externalstorage.documents/tree/primary%3AMusic%2FH%C3%B6rb%C3%BCcher/document/primary%3AMusic%2FH%C3%B6rb%C3%BCcher from pid=30266, uid=10323 requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs 05-07 20:36:33.751 30266 10653 D FolderScanner: Folder $Hörbücher scan Results: 0 Added | 0 Updated | 0 Removed | 0 Up-to-date 05-07 20:36:33.751 30266 10653 D FolderScanner: No Media Items to save 05-07 20:36:33.751 30266 10653 D AbsFileSystem: Scan DATA {"itemsAdded":0,"itemsUpdated":0,"itemsRemoved":0,"itemsUpToDate":0,"localFolder":{"id":"cHJpbWFyeTpNdXNpYy9Iw7ZyYsO8Y2hlcg==\n","name":"Hörbücher","contentUrl":"content://com.android.externalstorage.documents/tree/primary%3AMusic%2FH%C3%B6rb%C3%BCcher/document/primary%3AMusic%2FH%C3%B6rb%C3%BCcher","basePath":"Music/Hörbücher","absolutePath":"/storage/emulated/0/Music/Hörbücher","simplePath":"primary:Music/Hörbücher","storageType":"EXTERNAL","mediaType":"book"},"localLibraryItems":[]} ``` ### Environment data Audiobookshelf Version: Android App (0.9.44-beta), Server (2.0.11) - [x] Android App? - [ ] iOS App? #### Android Issue Android version: 11 Device model: Galaxy S10 Stock or customized system: Lineage OS 18.1 #### iOS Issue iOS Version: iPhone model:
adam added the bug label 2026-04-24 23:08:38 +02:00
adam closed this issue 2026-04-24 23:08:39 +02:00
Author
Owner

@jrbarronumd commented on GitHub (May 12, 2022):

I'm seeing this issue on my Pixel 5a as well. Is this not a widespread/common issue? Is there something wrong with my folder location or something? My folder structure is below. I can listen on my phone to local files for a while, but via Android Auto it fails almost immediately.

Internal storage/AudiobookShelf/Audiobooks
Internal storage/AudiobookShelf/Podcasts

@jrbarronumd commented on GitHub (May 12, 2022): I'm seeing this issue on my Pixel 5a as well. Is this not a widespread/common issue? Is there something wrong with my folder location or something? My folder structure is below. I can listen on my phone to local files for a while, but via Android Auto it fails almost immediately. Internal storage/AudiobookShelf/Audiobooks Internal storage/AudiobookShelf/Podcasts
Author
Owner

@advplyr commented on GitHub (May 13, 2022):

I don't think it is a common issue this is the first I've heard of it. I don't have this issue on Pixel 6 Android 12

@advplyr commented on GitHub (May 13, 2022): I don't think it is a common issue this is the first I've heard of it. I don't have this issue on Pixel 6 Android 12
Author
Owner

@klestajacek commented on GitHub (May 13, 2022):

I have similar behaviour on LG V30 after restarting phone. In my case local books are stored in internal_storage/download/Audibookshelf

Scan / force rescan does not find any books. I need to remove this folder and select it from scratch - only then app finds them

@klestajacek commented on GitHub (May 13, 2022): I have similar behaviour on LG V30 after restarting phone. In my case local books are stored in internal_storage/download/Audibookshelf Scan / force rescan does not find any books. I need to remove this folder and select it from scratch - only then app finds them
Author
Owner

@advplyr commented on GitHub (May 13, 2022):

@klestajacek What Android version?

@advplyr commented on GitHub (May 13, 2022): @klestajacek What Android version?
Author
Owner

@klestajacek commented on GitHub (May 13, 2022):

Sorry. It is 9.0

@klestajacek commented on GitHub (May 13, 2022): Sorry. It is 9.0
Author
Owner

@Sacerdoss commented on GitHub (May 13, 2022):

I recently installed a fresh LineageOs (Android 11) same version on my new phone and thus had a fresh install of the audiobookplayer app.
The issue is not reproducable for me since then.

Might be that the problem is gone by uninstalling the app and installing it fresh.

@Sacerdoss commented on GitHub (May 13, 2022): I recently installed a fresh LineageOs (Android 11) same version on my new phone and thus had a fresh install of the audiobookplayer app. The issue is not reproducable for me since then. Might be that the problem is gone by uninstalling the app and installing it fresh.
Author
Owner

@jrbarronumd commented on GitHub (May 14, 2022):

Looks like the reinstall may have solved my issue as well. I'll check on AA later, but closing the app doesn't cause issues anymore.

@jrbarronumd commented on GitHub (May 14, 2022): Looks like the reinstall may have solved my issue as well. I'll check on AA later, but closing the app doesn't cause issues anymore.
Author
Owner

@advplyr commented on GitHub (Jun 22, 2022):

Let me know if this happens again, I'm not able to reproduce.

@advplyr commented on GitHub (Jun 22, 2022): Let me know if this happens again, I'm not able to reproduce.
Author
Owner

@klestajacek commented on GitHub (Jun 22, 2022):

I changed phone to galaxy s10plus :)
No problem here.

@klestajacek commented on GitHub (Jun 22, 2022): I changed phone to galaxy s10plus :) No problem here.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf-app#124