In my app, I ask for permission to access SMS in Android SDK 23 (runtime permission) but the problem is dialog screen overlay showed up and access not granted .i disabled all another apps overlay but nothing changed. I found this link but not helped
and the question is how can I fix it programmatically?
If you see a 'Screen overlay detected' error (see example image below), it's caused by conflict between a running app and a newly installed app requesting permission to display info on multiple screens (e.g., messengers, alerts, battery status, etc.).
Turn off screen overlay on Settings Just tap on the “OPEN SETTINGS” link to “Draw over other apps” page, which displays all the apps that are permitted to draw over other apps. You may have to disable the toggle on each app until the problem is fixed.
Ok,
finally I found the solution, I search all the web and can't find anything useful. The answer is: When you ask for new permission don't ever do something else like showing toast or.... In my case I restart my app and ask for the next permission I use this code for restart the app.
Good luck.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With