Open the APK settings via API

Asked

Viewed 68 times

0

I would like to know how to make the user fall into the application settings (APK) via API, for example, the user put the option "Do not ask again",in the permissions of the application, and I open a alertDialog that makes the user go to the settings of the app allow directly.

1 answer

1


You can use the code below to display an Alert with the option to go to the APP settings

AlertDialog dialog = new AlertDialog.Builder(SplashScreenActivity.this).create();
dialog.setTitle(getString(R.string.grant_permission_title));
dialog.setMessage(Html.fromHtml(getString(R.string.grant_permission_message)));
dialog.setButton(AlertDialog.BUTTON_NEGATIVE, getString(R.string.ok), new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
        dialog.dismiss();
        Intent intent = new Intent();
        intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
        Uri uri = Uri.fromParts("package", SplashScreenActivity.this.getPackageName(), null);
        intent.setData(uri);
        startActivityForResult(intent, 1);
    }
});

Browser other questions tagged

You are not signed in. Login or sign up in order to post.