3

Is there a way to redirect a user to the settings of an application or better to the permissions of a specific application? as shown below:

enter image description here

enter image description here

Best regards.

2 Answers 2

12

There is no intent to go directly to permissions page.

However, there is an intent by which you can redirect your user to your Application's detailed settings page. ACTION_APPLICATION_DETAILS_SETTINGS

Here is the code snippet:

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); 

I hope this helps!

Sign up to request clarification or add additional context in comments.

2 Comments

the context it is undefined so it is the activity what do I need to write there for both of them ? I tried getApplicationContext().startActivity but it is throwing me error.
This is creating runtime exception android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. so we need to set the flag for the intent intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
5

Is there a way to redirect a user to the settings of an application

Use ACTION_APPLICATION_DETAILS_SETTINGS.

or better to the permissions of a specific application?

I do not think that there is a way to drive to that specific screen.

4 Comments

I'm getting a crash: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.APPLICATION_DETAILS_SETTINGS }
@FeleMed: As the documentation states, "In some cases, a matching Activity may not exist, so ensure you safeguard against this." Beyond that, you need to put a Uri on the Intent, one with a package scheme that points to your app. See stackoverflow.com/a/32983128/115145.
ACTION_APPLICATION_DETAILS_SETTINGS worked, thanks. On the second question, here: youtube.com/watch?v=f17qe9vZ8RM at around 27:30 the speaker said that if your permissions haven't been denied before you can intent directly to the app permissions, can't find the documentation though.
@FeleMed: I don't see anything undocumented in the current Settings app's manifest that fits the bill, but, then again, there are a million references to "permission" in there... :-)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.