Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I eavesdrop Android touch events?

I'm working on detecting gestures and touches on an Android device. The problem is that my App will need to detect these gestures outside of its own View, on other Apps or even the home screen. In other words, is there a way to eavesdrop on touch events? I would imagine there are a few security measures preventing this. I just need to prove the concept, so I would try this on a development device where I can disable any security that could prevent me from doing this (without causing harm to anyone or exposing their data).

like image 296
pypmannetjies Avatar asked Jul 17 '12 14:07

pypmannetjies


2 Answers

You can't do this by design. It would be a huge security risk if Android allowed you to do something like that. Think about it, if you could do this, you could easily make all sorts of malicious applications like a key logger. As for the background service suggestion, it's not possible to use a background service to intercept touch events from another app. Basically, Google has done this on purpose, you cannot mess with another application's lifecycle or event handlers, etc. etc.. In fact, Google would consider what you're trying to do as malicious code even if your intent for writing the code isn't malicious or illegal, it's simply outside of the security paradigm Android has chosen, and thus it's considered malicious so Google will do what it can to not allow you to do that.

like image 100
Andi Jay Avatar answered Sep 22 '22 11:09

Andi Jay


Well, it's very very limited but you could use the AccessibilityEvents on a background services to track hovering and screen exploring, but again is very limited, but it doesn't require you to get any special or magic permission from google or building your own ROM haha, I hope this helps :)

like image 41
Kenny D. Avatar answered Sep 23 '22 11:09

Kenny D.