Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android "Screen Overlay Detected" message if user is trying to grant a permission when a notification is showing

I have Android Marshmallow on a Nexus 6. I am trying to fix the following problem:

If a user is trying to grant permission while a notification is showing, a "Screen overlay detected" message gets displayed and the Request Permission dialog disappears - of course the app does not get the requested permission. (Check screenshot)

I tried to fix the problem by adding "DRAW OVER OTHER APPS" permission - android.permission.SYSTEM_ALERT_WINDOW to the manifest but with no luck.

PS: I am sure the problem is caused by the notification. I do not have any app installed that overlays over other apps, I even turned off all apps with "Draw over other apps" permission in the settings. Did not help..

Anyone knows a solution to that problem?

enter image description here

like image 392
Alexi Akl Avatar asked Feb 17 '16 10:02

Alexi Akl


2 Answers

In the circumstance that I ran across, I was causing the problem myself. It was the result of using a Toast to display information to the user at the same time that I was asking for permission. Both of these actions together cause this type of error.

The other answers might resolve someone else's issue. But I wanted to note that you should be cautious of causing your own overlays errors. Be careful of overlaying something in the view while simultaneously asking for permission.

like image 144
Jay Snayder Avatar answered Sep 24 '22 13:09

Jay Snayder


Uninstall Clean Master app. I uninstalled it and problem solved

like image 44
Hojjat Avatar answered Sep 26 '22 13:09

Hojjat