Skip to content Skip to sidebar Skip to footer

How To Ask For Photos/Media/Files Permission In Android App

enter image description here I want my app to ask for Photos/Media/Files permission since a third party library requires it, can anyone tell me which specific permission to ask for

Solution 1:

Files, photos and media are saved in storage. Your android app will request permission in the relation of what it requires to do. Add the permissions in your Manifest file.

The permission you require is:

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

If you want to save Files with your app too, request:

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

Android versions from Marshmallow and above require runtime grant of permissions. Run the following

String[] PERMISSIONS = {
        Manifest.permission.WRITE_EXTERNAL_STORAGE,
        Manifest.permission.READ_EXTERNAL_STORAGE
};
ActivityCompat.requestPermissions(this,
PERMISSIONS,
PERMISSION_REQUEST_READ_FOLDERS);

Post a Comment for "How To Ask For Photos/Media/Files Permission In Android App"