Elior Elior - 3 months ago 6x
Android Question

Android 6 requesting a permission

In android 6 I'm requesting a permission to use the storage.
Now when the user denied my request I want to show him a dialog that explain why the permission is needed for the application in order to get his permission.

How can this be done?

Is there any built in dialog like the one that pop up's when you use the request permissions method?


It is good to show custom dialog before asking for permission, so that user can decide whether permission should be accept or decline.

you can use this

int hasReadPermission = checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE);

if (hasReadPermission != PackageManager.PERMISSION_GRANTED) {
    //show your custom dialog regarding why you need this permission

when user click on button of dialog, show them permission dialog by using

requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},