Options
All
  • Public
  • Public/Protected
  • All
Menu

RootAutomator is used to simulate click, gesture, and long press operations based on root or adb permission. Compared to the operation based on accessibility, RootAutomator supports multiple-touch and dynamic gesture, but may not be compatible with all devices.

Hierarchy

  • RootAutomator

Index

Methods

exit

  • exit(forcedly?: boolean): Promise<void>
  • Exit RootAutomator.

    Parameters

    • Optional forcedly: boolean

      If true, the process will be forcibly killed and the operation will be interrupted; if false, the process will be exited after the current operation ends.

    Returns Promise<void>

    A Promise object, which will be resolved when the operation is completed.

longPress

  • longPress(x: number, y: number, id?: number): Promise<void>
  • Long press on (x, y) position. The duration of long press is ViewConfiguration.getLongPressTimeout()+100 milliseconds.

    Parameters

    • x: number
    • y: number
    • Optional id: number

      Finger ID, default is 0

    Returns Promise<void>

    A Promise object, which will be resolved when the operation is completed.

press

  • press(x: number, y: number, duration: number, id?: number): Promise<void>
  • Press on (x, y) position for the given duration, then lift the finger.

    Parameters

    • x: number
    • y: number
    • duration: number

      Press duration, unit is milliseconds

    • Optional id: number

      Finger ID, default is 0

    Returns Promise<void>

    A Promise object, which will be resolved when the operation is completed.

sendEvent

  • sendEvent(type: number, code: number, value: number): void
  • Parameters

    • type: number
    • code: number
    • value: number

    Returns void

sendSync

  • sendSync(): void
  • Returns void

swipe

  • swipe(x1: number, y1: number, x2: number, y2: number, duration: number, id?: number, sampleMs?: number): Promise<void>
  • Swipe from (x1, y1) to (x2, y2) position on the given duration.

    Parameters

    • x1: number
    • y1: number
    • x2: number
    • y2: number
    • duration: number

      Swipe duration, unit is milliseconds

    • Optional id: number

      Finger ID, default is 0

    • Optional sampleMs: number

      Swipe point sampling time, unit is milliseconds, default is 8 milliseconds

    Returns Promise<void>

    A Promise object, which will be resolved when the operation is completed.

syncReport

  • syncReport(): void
  • Returns void

tap

  • tap(x: number, y: number, id?: number): Promise<void>
  • Click position (x, y), duration is 5 milliseconds.

    Parameters

    • x: number
    • y: number
    • Optional id: number

      Finger ID, default is 0

    Returns Promise<void>

    A Promise object, which will be resolved when the operation is completed.

touch

  • touch(x: number, y: number): void
  • Parameters

    • x: number
    • y: number

    Returns void

touchDown

  • touchDown(x: number, y: number, id?: number): void
  • Touch down on (x, y) position.

    Parameters

    • x: number
    • y: number
    • Optional id: number

      Finger ID, default is 0

    Returns void

touchMove

  • touchMove(x: number, y: number, id?: number): void
  • Move finger to (x, y) position.

    Parameters

    • x: number
    • y: number
    • Optional id: number

      Finger ID, default is 0

    Returns void

touchUp

  • touchUp(id?: number): void
  • Touch up.

    Parameters

    • Optional id: number

      Finger ID, default is 0

    Returns void

touchX

  • touchX(x: number): void
  • Parameters

    • x: number

    Returns void

touchY

  • touchY(y: number): void
  • Parameters

    • y: number

    Returns void