androidpermissionsandroid-external-storage

No Android WRITE_EXTERNAL_STORAGE permission, with ALL_FILE_ACCESS granted?


I have a music player app (that only I use, it is not in Google Play nor it will ever be) with the following Manifest permissions:

<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:ignore="ScopedStorage" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"/>
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" tools:ignore="ScopedStorage" />
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>

The device reports that the app also have ALL_FILES_ACCESS permission granted (I want it that way).

Still, the app reports that it has no WRITE_EXTERNAL_STORAGE permission when I try the usual requestPermissions.

However, there is no permission in the App settings regarding storage to be allowed, and it says No permissions denied.

I tried forcing with adb shell like this:

appops set --uid myApp.xvfmusic WRITE_EXTERNAL_STORAGE allow

and the app still keeps asking for permissions...

Why is the thing asking me to set WRITE_EXTERNAL_STORAGE, and why there is no such permission to set in the app config?


Solution

  • "WRITE_EXTERNAL_STORAGE is deprecated (and is not granted) when targeting Android 13+. If you need to write to shared storage, use the MediaStore"

    As of Android 13, if you need to query or interact with MediaStore or media files on the shared storage, you should be using instead one or more new storage permissions:

    • android.permission.READ_MEDIA_IMAGES
    • android.permission.READ_MEDIA_VIDEO
    • android.permission.READ_MEDIA_AUDIO

    Looks like your device is running Android 13+ and that's why you cant request "WRITE_EXTERNAL_STORAGE"

    MANAGE_EXTERNAL_STORAGE supersedes WRITE_EXTERNAL_STORAGE & allows broad access to external storage. You don't need WRITE_EXTERNAL_STORAGE if you already have MANAGE_EXTERNAL_STORAGE permission granted.

    To publish apps with MANAGE_EXTERNAL_STORAGE permission, you'll need clear justification for requesting it, otherwise the app will be rejected. Since you're not publishing the app on Google Play, it's fine. But those who think MANAGE_EXTERNAL_STORAGE is the alternative to WRITE_EXTERNAL_STORAGE, they're wrong. If they can't clearly justify the need to request MANAGE_EXTERNAL_STORAGE (which most apps can't), their apps will be rejected. Their choice should be either app specific external storage (Android/data/package-name) access or the ones described in documentation above