Skip to main content

Perform Touch Interaction

There are 3 type of touch interactions in Android Macro

Clicks

To perform tap behaviour in your screen, you can use Screen:click() function which is available in Screen class. For Example

Screen:click(Point(200, 250))
# or
Screen:click(200, 250)

Equivalent to

Requirements app version 1.0.0.0 and higher

Swipes

To perform swipe behaviour in your screen, you can use Screen:swipe() function which is available in Screen class. The Screen:swipe() function requires a list of SwipePoint(x: int, y: int, holdDuration: int, speed: int)

Screen:swipe({
SwipePoint(200, 250, 1, 2),
SwipePoint(500, 230, 1, 2),
})

Equivalent to

Requirements app version 1.0.0.0 and higher

Hold Clicks

To perform hold clicks, you can use Screen:click() function but this time, we can laveraging the ClickParams() function to modify the press and hold duration. For Example

Screen:click(Point(200, 250), ClickParams():setDuration(2000))

Equivalent to

The 2000 value is the duration of the press in milliseconds. If you run this code/builder, the macro will do hold click at X: 200, Y: 250 with duration press of 2 seconds.