How to request and grant MANAGE_EXTERNAL_STORAGE permission

In this guide I show you, how to request and grant → MANAGE_EXTERNAL_STORAGE on devices with Android 11+. Be aware that this permission is usually not granted by Google. However, let’s assume the app is only intended for private use or for special users or for other app stores.

This permission must be declared in the Manifest (since it is not declared the Companion app you can't test this with Companion):

<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>

Here is a small extension that declares this permission automatically in the Manifest (and let you check the API level of the device):
AllFilesPermission.aix (4.3 KB)

Currently you must still set → DefaultFileScope to → Legacy in the Designer.

10 Likes

I can not read the complete text
android.settings.MANAGE_ALL_FILES_ACCESS_PERMISS.... ???

1 Like
android.settings.MANAGE_ALL_FILES_ACCESS_PERMISSION
4 Likes

I tested Anke's extension with this blocks, it runs, I can read my file, but all times opens file access window.


How can I request permission first time only ?

my solution

After the permission is granted and you can save the text file e.g. in the root dir of the external storage, you can set Button1 to invisible since this is no longer needed:

2 Likes

Thank you Anke for sharing your knowhow

why blocks seem bit different to me :thinking:

What does that mean?

I think we need
blocks2

No, why?

UI of input for blocks seems different to me

Those are inlined, you can right-click on the block to inline it.

2 Likes

Here my blocks, if I don't use "if all tinyDB1.getvalue = false it shows all times access window

This post was flagged by the community and is temporarily hidden.

Here you'll find instruction how to patch the companion to get additional permissions: https://ullisroboterseite.de/android-ai2-faq.html?topic=patchcompanion

2 Likes

I can not understand how this patch can help to get manage permission

Add this line to the Manifest of the MIT_Companion.APK

    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>

These are then all declared permissions:

Permissions
    <uses-feature android:name="android.hardware.bluetooth" android:required="false"/>
    <uses-feature android:name="android.hardware.location" android:required="false"/>
    <uses-feature android:name="android.hardware.telephony" android:required="false"/>
    <uses-feature android:name="android.hardware.location.network" android:required="false"/>
    <uses-feature android:name="android.hardware.location.gps" android:required="false"/>
    <uses-feature android:name="android.hardware.microphone" android:required="false"/>
    <uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
    <uses-feature android:name="android.hardware.camera" android:required="false"/>
    <uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
    <uses-feature android:name="android.hardware.wifi"/>
    <uses-permission android:name="android.permission.READ_CONTACTS"/>
    <uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH"/>
    <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
    <uses-permission android:name="android.permission.CALL_PHONE"/>
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
    <uses-permission android:name="android.permission.NFC"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
    <uses-permission android:name="android.permission.RECEIVE_SMS"/>
    <uses-permission android:name="android.permission.SEND_SMS"/>
    <uses-permission android:name="android.permission.VIBRATE"/>
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
    <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.USE_CREDENTIALS"/>
    <uses-permission android:name="android.permission.READ_CALL_LOG"/>
    <uses-permission android:name="android.permission.ACCOUNT_MANAGER"/>
    <uses-permission android:name="com.google.android.apps.googlevoice.permission.RECEIVE_SMS"/>
    <uses-permission android:name="com.google.android.apps.googlevoice.permission.SEND_SMS"/>
    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.BLUETOOTH"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
    <uses-permission android:name="android.permission.READ_LOGS"/>
    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>

If you use this version, you can also test your apps (that request MANAGE_EXTERNAL_STORAGE) with Companion.