adbKit

package
v3.26.103 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance struct {
	/*
		截图的锁,防止并发冲突.
		PS: 截图频率不要太高,建议至少要间隔500~1000ms。
	*/
	sync.Mutex
	// contains filtered or unexported fields
}

func NewInstance

func NewInstance(address string, cleanFlag, verbose bool) (*Instance, error)

func (*Instance) GetPhysicalSize

func (ins *Instance) GetPhysicalSize() (width int, height int, err error)

GetPhysicalSize 获取:分辨率(宽高、尺寸).

func (*Instance) LongPress

func (ins *Instance) LongPress(x, y int, duration int) error

LongPress 长按.

命令:adb -s 127.0.0.1:5555 shell input swipe 500 1000 500 1000 2000

@param duration: 持续时间(单位:ms)

func (*Instance) LongPressLikeAHumanBeing

func (ins *Instance) LongPressLikeAHumanBeing(x, y int, duration int, axisOffset, timeOffset int) error

LongPressLikeAHumanBeing

@param duration 	持续时间(单位:ms)
@param timeOffset 	持续时间的偏移量(单位:ms)

func (*Instance) Screenshot

func (ins *Instance) Screenshot(targetPath string) error

Screenshot 截图

@param targetPath 截图保存的路径(PNG格式)

func (*Instance) Swipe

func (ins *Instance) Swipe(x1, y1, x2, y2 int, duration int) error

Swipe 滑动.

命令:adb -s 127.0.0.1:5555 shell input swipe <x1> <y1> <x2> <y2> <duration>

@param x1, y1: 起始坐标
@param x2, y2: 结束坐标
@param duration: 持续时间(单位:ms)

e.g. 	向上滑动(上滑刷新/滚动)
	adb -s 127.0.0.1:5555 shell input swipe 500 1500 500 500 300
e.g.1 	向下滑动(下拉通知栏)
	adb -s 127.0.0.1:5555 shell input swipe 500 100 500 1000 300
e.g.2 	向左滑动
	adb -s 127.0.0.1:5555 shell input swipe 900 500 100 500 300
e.g.3 	向右滑动
	adb -s 127.0.0.1:5555 shell input swipe 100 500 900 500 300

func (*Instance) SwipeLikeAHumanBeing

func (ins *Instance) SwipeLikeAHumanBeing(x1, y1, x2, y2 int, duration int, axisOffset, timeOffset int) error

SwipeLikeAHumanBeing 像人一样滑动(每次的位置和时间都不一样).

@param duration 	持续时间(单位:ms)
@param timeOffset 	持续时间的偏移量(单位:ms)

func (*Instance) Tap

func (ins *Instance) Tap(x, y int) error

Tap 点击.

命令:adb -s 127.0.0.1:5555 shell input tap <x> <y>

func (*Instance) TapLikeAHumanBeing

func (ins *Instance) TapLikeAHumanBeing(x, y int, axisOffset int) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL