Search code examples
androidserviceoverlaytouch-event

android service overlay touch event


I'm trying to make a service which displays a button after the user touches anywhere on the screen.

I looked for a lot of similar topics but, I can't succeed for now.

I tried to display a Layout with TYPE_SYSTEM_OVERLAY and some flags but I can't get any touchEvent on my service..

At the opposite, I tried with TYPE_TOAST, TYPE_PHONE, TYPE_SYSTEM_ALERT, but with that, I have the touchEvent on my service working, but not on the current activity..

Do anyone have a solution to get the touchEvent on the service and still perform actions below the overlay ?


Solution

  • Fortunately, that is not possible, for obvious privacy and security reasons. What you are describing is called a tapjacking attack, and it has been blocked on Android since about Android 4.0.