2

I've been playing around with Amazon FireTV Stick with adb. the input tap X Y does not seem to work. I want to simulate mouse input from my laptop connected to the FireTV. input press seems to be working just fine. Any hints on inputting a tap by coordinates? The device is not rooted. I've got a screenshot and got coordinates on the image with just GIMP.

The main reason I believe this is possible, is because there is an app that shows a mouse cursor and taps in various locations work just fine. I suspect it's not the actual Android built in cursor. But it may well be, in which case I'll be on the hunt of displaying it when needed and controlling it. If you have a suggestion about this, please point me in the right direction.

My main idea is to take a screenshot, find the coordinates of the button on the screen and do a tap at those coordinates. I am not considering choosing this button with keys and doing input press. Any ideas?

Amir
  • 717
  • 2
  • 9
  • 21

2 Answers2

0

If you want to run an app on the device to manage it, then using MotionEvent will allow you to simulate an action at a location.

If you want to control it via adb then a MonkeyRunner script would be the easiest (see https://developer.android.com/studio/test/monkeyrunner/index.html):

# 
# usage: monkeyrunner tap_xy.py
#

# Import monkeyrunner modules
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice

# Connects to the current device
device = MonkeyRunner.waitForConnection()

# Click at X,Y 
y = 400
x = 100

device.touch(x, y, MonkeyDevice.DOWN_AND_UP)
Offbeatmammal
  • 7,970
  • 2
  • 33
  • 52
0

Create a UI automator service running , using UiDevice.click(x,y) method you can click on the screen.

UiDevice

Vins
  • 4,089
  • 2
  • 35
  • 50