Skip to content Skip to sidebar Skip to footer

System Overlay Detector

Is there a way to detect within my own app that a Screen Overlay is currently present? For example, I see in the settings that they detect it: I would like to know if there is a w

Solution 1:

Android View documentation offers clear ways :

To enable touch filtering, call setFilterTouchesWhenObscured(boolean) or set the android:filterTouchesWhenObscured layout attribute to true. When enabled, the framework will discard touches that are received whenever the view's window is obscured by another visible window. As a result, the view will not receive touches whenever a toast, dialog or other window appears above the view's window.

For more fine-grained control over security, consider overriding the onFilterTouchEventForSecurity(MotionEvent) method to implement your own security policy. See also FLAG_WINDOW_IS_OBSCURED.

Also refer to this sample code.

Post a Comment for "System Overlay Detector"