Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android detecting the touch state from any application

Is it possible to detect touch events from within another application, specifically swipes? I'd like to be able to detect if the user has swiped left or right (even with 2 fingers - but not required). Perhaps there is a service or broadcast I can listen to.

or failing that, is there some API perhaps that I can poll say 10 times a second to get the touch state and I can compute the rest (why, I remember writing a mouse driver strobing the COM1 port with IN OUTs in 8086 assembler coded in a TSR on a XT...)!

Anyway, any help appreciated. (I think it could be done by hijacking the primary Launcher and having a transparent click-through on-top activity, but that's seriously fraud with danger!)

like image 668
Jonathan Avatar asked Nov 06 '22 04:11

Jonathan


1 Answers

Is it possible to detect touch events from within another application, specifically swipes?

Fortunately, no.

or failing that, is there some API perhaps that I can poll say 10 times a second to get the touch state and I can compute the rest

Fortunately, no.

I think it could be done by hijacking the primary Launcher and having a transparent click-through on-top activity

Fortunately, no.

You are welcome to write your own home screen application, in which case you can track your own touch events on your own home screen. You are welcome to write an ordinary application and track your own touch events on your own activities.

like image 72
CommonsWare Avatar answered Nov 09 '22 04:11

CommonsWare