ADBScreen#aTap() not working on new release

Asked by johnny doe on 2018-12-24

Hello I was able to do aTap on older sikulixapi but it doesn't have the ADBScreen#getDevices() function. Please help me I will share my money after I create the bot.

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2018-12-24
Last reply:
2018-12-25
RaiMan (raimund-hocke) said : #1

I will check and come back asap.

RaiMan (raimund-hocke) said : #2

Just checked (looking into the implementation code - I cannot test with more than one device currently).

--- ADBScreen#getDevices()
indeed is defined, but not yet implemented (returns an empty list).
use getDevice(), to get the first or only attached device

... but this is not needed for aTap and other Region::a..Methods.

Generally you have to follow
https://sikulix-2014.readthedocs.io/en/latest/screen.html#connecting-to-an-android-device-or-emulator-adbscreen
to get the android-support working and access to the first attached device in the row or emulator.

ascr = ADBScreen.start()
ascr.aTap(someSpot)

where someRegion is either a Region or Location dedicated to the Android device:
someSpot = ascr.newRegion(x, y, w, h) # taps the center of the region
someSpot = ascr.newLocation(x, y) # taps the location on the android
someSpot = ascr.find(someImage) # taps the center of the match-region

If you have more than one device/emulator attached, they are recognised, but there is no list currently.

You can get one device in the row as:
ascrN = ascr.getScreenWithDevice(n)

So with 2 devices attached:
ascr1 = ascr.getScreenWithDevice(1)

now you can do the same things with ascr1 as with ascr.

BE AWARE: not all Region/Location features automatically know, that they are on an android, especially those created from scratch.

in doubt use the ascr.newRegion()/newLocation() features to dedicate one to an android.

Matches resulting from find ops on an android automatically are dedicated to the android.

Can you help with this problem?

Provide an answer of your own, or ask johnny doe for more information if necessary.

To post a message you must log in.