Open APK settings via API

0

I'd like to know how to drop the user's APK settings via API , for example, the user put the "Do not ask me again" option, in the permissions of the application, and I open an alertDialog that causes the user to go to the settings of the allow app directly.

    
asked by anonymous 01.06.2018 / 17:01

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);
    }
});
    
04.06.2018 / 19:33