nsandersen
nsandersen

Reputation: 976

How can I open the user access permissions for a particular app

This answer shows how to open the general Usage access settings for all apps:

 startActivity(new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS));

How can I open the Usage access settings for a specific app on that list directly?

I tried

startActivity(new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS).putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName()));

but this does the same as the previous line. Thank you.

Upvotes: 2

Views: 2228

Answers (3)

user14875536
user14875536

Reputation:

Use the following in an activity -

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

Upvotes: 1

BBB
BBB

Reputation: 342

This works for me (tested on Android 9 / 10):

val intent = Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS)
intent.data = Uri.fromParts("package", packageName, null)
startActivity(intent)

Upvotes: 6

Mahmoud Waked
Mahmoud Waked

Reputation: 395

Open your app settings screen Then click on Permissions because there is no intent to go directly to the Permissions screen.

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

Upvotes: 1

Related Questions