How can I force touch events on none routed Androi

2019-03-06 19:42发布

问题:

I would like to write an application which can programatically generate touch events on the phone.

I have already tried this methods:

  • adb : adb swipe and so on... It requires USB cable and connect the phone to pc
  • adb ON TCPIP: same My problem with adb is to require so much presetting by user and I don't want to make the user to learn it. I have already made an application which use adb, but it's difficult for the user to set up properly :(

  • I have heard and I tried to sign my application with platform sign, but it's not good for me, because I would like to publish my app on android market and it is not a system application...

I would like to find a way to achieve this in a single application which can produce touch outside of the app (from background) and I would like to publish on market.

I have found this application: https://play.google.com/store/apps/details?id=com.teamviewer.quicksupport.samsung which can basically do this. Because when I click on my computer, it send a message to the phone and the phone make the touch on the screen. How and with what privileges can teamviewer do it?

Please give me some advice about it.

回答1:

I would like to find a way to achieve this in a single application which can produce touch outside of the app (from background) and I would like to publish on market.

This is not possible, outside of what little input faking can be done by an accessibility service.

How and with what privileges can teamviewer do it?

If your read that Play Store listing, you will notice that it only works with Samsung devices. That is because the makers of TeamViewer struck a deal with Samsung to enable this sort of integration. Similarly, the TeamViewer team struck deals with a few other device manufacturers. However, they did not do so with all manufacturers, and so TeamViewer does not work on all devices.