1

In my App i check for overlay permission if i don't have it i prompt the user to enable it system setting, I'm trying to create a dialogue or a toast but the dialogue doesn't appear in the new activity

 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        if (!Settings.canDrawOverlays(this)) {
            Intent overLay = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName()));
            AlertDialog.Builder dialog = new AlertDialog.Builder(MainActivity.this);
            dialog.setCancelable(true);
            dialog.setTitle("Required");
            dialog.setMessage("please Enable" );
            final AlertDialog alert = dialog.create();
            alert.show();
            startActivity(overLay);


        }
    }
keyur patel
  • 99
  • 1
  • 7

0 Answers0