Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open application permission window in app settings programmatically [duplicate]

I'm working on new permission model (Android 6.0 Marshmallow) and I wonder is there a way to open the application's permission window programmatically?

app permissions

not only application details

app settings

I managed to open the second screen using something like this

private void goToSettings() {     Intent myAppSettings = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:" + getPackageName()));     myAppSettings.addCategory(Intent.CATEGORY_DEFAULT);     myAppSettings.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);     startActivity(myAppSettings); } 

But I have no idea how to open the first one.

Your help will be much appreciated :)

like image 672
Karol Żygłowicz Avatar asked Feb 17 '16 12:02

Karol Żygłowicz


People also ask

How do I set permissions in Android programmatically?

You need to declare the permissions in the manifest file first before you request for them programmatically. refer this for more information. declaring the permission in the manifest file is static type declaration by which your os know what kind of permission your app might require.

How do you check auto start permission is enabled or disabled programmatically?

There's no way to find out whether the Auto-start option is enabled or not. You can manually check under Security permissions => Autostart => Enable Autostart .


1 Answers

This is not possible. You can open the App settings screen but not the permissions setting screen.

Refer to this question for more explanations.

Here I am sharing code to open application setting screen,

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

For more you can refer Open Application Settings Screen Android

like image 57
Ravi Avatar answered Sep 21 '22 22:09

Ravi