6

As many developers on Stackoverflow, I have got the problem that when a user grants a system dangerous permission, I have got the "Screen overlay detected" alert.

I have seen many answers:

  • some recommend to display an alert to open the phone settings so that the user can block the overlaying apps by himself (I don't like this, I don't want to ask something confusing to the user)
  • some other recommend to delete the apps which induce an overlay (it is just a non sense as I cannot ask this to my users...)
  • some others explain to take care to potential overlaying toasts from my own app (I don't perform any operation when the user accept the permission => not the cause of my problem)

So, what I want is to block PROGRAMMATICALLY any third party app which would like to overlay something on my app. I want everything to be invisible by the user.

Any possibility to do this ?

Thanks

toto_tata
  • 14,526
  • 27
  • 108
  • 198
  • 1
    I hope that is not possible. This is not because I like overlay apps -- I may hate them more than you do. However, your app should not have the ability to affect the behavior of other apps this way. – CommonsWare Feb 14 '17 at 17:01
  • 3
    What I hate is to see my app affected by these overlaying apps which induce bugs! – toto_tata Feb 14 '17 at 17:03
  • Did you find solution? – Kirill Shalnov Mar 31 '17 at 10:28
  • 1
    As long as Android 6.x is buggy on some devices where this "overlay alert" is displayed without any reason (on 2 to 5% of the devices according to my analytics data), the best solution is to avoid the whole permission process by defining the targetSdk to 22. Take care that you can't downgrade the target sdk for a new version or this will induce a INSTALL_FAILED_PERMISSION_DOWNGRADE error when the user updates requiring an unisntall/install of the app. – toto_tata Mar 31 '17 at 10:41

0 Answers0