-1

I am developing an android app which involves connecting mouse to your phone wirelessly so that,we can operate our phone using mouse...i've implemented almost everything but couldnt figure out the way to simulate human touch at (x,y) coordinates..this question has been asked few times but for other languages.. (javascript,html,mac/linux/windows,python)...i want to be able to click at specific location not a view....should i use monkeyrunner or monkey or TouchUtils class...please guide me,this is my college project..thanks in advance

shunryui nik
  • 82
  • 1
  • 8

2 Answers2

1

Try this from terminal:

input tap x y

Where x and y are your co-ordinates.

Skynet
  • 7,820
  • 5
  • 44
  • 80
  • thanks for your answer..but it says"input" is not recognized as an internal or external command..and btw the application is supposed to simulate touch itself ...not by using terminal...and it doesn't even make sense since there is no terminal in android phone!! – shunryui nik Feb 17 '15 at 12:37
  • You can direct commands to a terminal inside of your app!! I am not much sure but you can check [this](http://stackoverflow.com/questions/20932102/execute-shell-command-from-android). Once again I am not much sure if this approach will work. – Skynet Feb 17 '15 at 12:41
  • Also [this](http://tech-papers.org/executing-shell-command-android-application/) tutorial might be helpful! – Skynet Feb 17 '15 at 12:44
0

if you have adb installed:

adb devices

device that you want to touch should appear

adb -s NAME_OF_DEVICE shell input tap X Y 

this way you can have multiple devices connected and tap to the one you want.

This kind of tap is slow. If you want something faster try sendevent or monkeyrunner.

hopieman
  • 399
  • 7
  • 22