How to get if user enable the any permission from settings page of app in android

1.2k Views Asked by At

How to get if user enable the permission from setting page of application

For Example Consider a app has permission activity. In permission activity it show location permission default dialog. when user allow the permission I proceed the further steps. When user denied the permission, Then I show the permission dialog again. When user permanently denied. I redirect to app settings page using below code

Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Uri uri = Uri.fromParts("package", getPackageName(), null);
intent.setData(uri);
startActivity(intent);

How to get If user enable the particular permission from the settings page of app like get result from Activity Result.

1

There are 1 best solutions below

2
Arno den Hond On

The application details settings intent does not provide any activity result.

You need to keep track of what permissions were granted before starting the details settings intent and comparing that to what permissions are granted when your activity resumes.

To do this, you can use checkSelfPermission