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?
Solution 1:
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.
Solution 2:
Uninstall Clean Master app. I uninstalled it and problem solved
Solution 3:
This problem appear because of some culprit application like Twilight, cleaner-master, drupe etc..
To solve this problem you have to disable screen overlay for those culprit apps.
i have moto g4 plus, and this is how i solve this problem
Go to Setting --> Select Apps ---> again select setting icon in Apps ---> select draw over other apps ---> and disable culprit apps who trouble for other apps.
what i done is checking each apps by disabling this permission and try to run my app, and i found one app this troubling overlay for other apps, so at the end i disabled only this app.
ScreenShots:
Solution 4:
Got insights from multiple answers here and other forums .
Consolidating how I got rid of the issue :
- Go to Settings > Apps > (your app which is getting issue)
- Press on Power button till window for Power off , reboot , airplane mode comes up
- Hold on Power off option
- Select reboot in Safe mode
- Go to settings > apps > (your app which is getting issue)
- Select whichever permissions you want
- After Android M update , issues can come up in apps like Messenger , Whatsapp , Prisma etc.
Let me know if any issues .
Note : I am having One plus One mobile.