I'm trying to receive touch events from my Android device to a C# application on my PC.
My project involves splitting the screen into multiple sections that I want to detect touch events in. Eg. My device can register ABS_MT_POSITION_Y updates from 0 to 4000, so 0 to 1000 is the 1st section, 1001 to 2000 is the 2nd section and so on.
I am translating which section is touched/released to key down/up events on my PC which a 3rd party app will be detecting.
I'm using the adb command shell getevent -l to receive these events from the connected device.
To receive this in C#, I create process for adb.exe and read lines from the StandardOutput stream, the output from the above mentioned command that I'm interested in are:
EV_KEY BTN_TOUCH DOWN
EV_ABS ABS_MT_POSITION_Y 0000091e
EV_KEY BTN_TOUCH UP
This is all well and good, but I noticed an issue: Only the initial touch of the screen is considered a BTN_TOUCH DOWN event. If I touch and hold one part of the screen, and attempt to touch another part of the screen at the same time, the 2nd touch does not raise these events.
On another note, it's difficult to determine from these events which touch on the screen would have raised the BTN_TOUCH UP event as the position events do not really relate to the button events.
Is there a more reliable way of doing this? It would be nice if I could receive both a touch down/up event along with the position where the event happened and also receive touches in multiple areas of the screen at the same time.