I want to dismiss the system generated run time user permission programmatically. Is there any way??
Asked
Active
Viewed 1,004 times
0
-
Why do you want to do this? While you can possibly dismiss the alert, you cannot grant the requested permission with code. – Richard Le Mesurier Dec 28 '18 at 12:29
1 Answers
0
Send an intent with action of Intent.ACTION_CLOSE_SYSTEM_DIALOGS
.
This is sent by the system when the HOME key is pressed and should close all dialogs.
The below code is copied from a related question.
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (! hasFocus) {
Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
sendBroadcast(closeDialog);
}
}

Richard Le Mesurier
- 29,432
- 22
- 140
- 255