How to programmatically open the Permission Screen for a specific app on Android Marshmallow?

Frederik Schweiger picture Frederik Schweiger · Sep 28, 2015 · Viewed 158.1k times · Source

I have a question regarding the new Android Marshmallow release:

Is it achievable to display the Permission Screen for a specific app via an Intent or something similar?

Android M Permission Screen

It's possible to display the app settings with the following code - is there an analog solution for directly opening the Permission Screen?

startActivity(new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.fromParts("package", getPackageName(), null)));

I already did some research on this but I wasn't able to find a proper solution - I would appreciate every help!

Answer

Martin Konecny picture Martin Konecny · Oct 7, 2015

According to the official Marshmallow permissions video (at the 4m 43s mark), you must open the application Settings page instead (from there it is one click to the Permissions page).

To open the settings page, you would do

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