goadb

package module
v0.0.0-...-e8b31eb Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2025 License: MIT Imports: 11 Imported by: 0

README

GoADB

Golang ADB library

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteCommand

func ExecuteCommand(command string) ([]byte, error)

Execute a raw adb command and return the output

func PairDevice

func PairDevice(endpoint string, code string) error

Pair a device using the 6 digit code

Types

type Device

type Device struct {
	Serial  string
	Screenx int
	Screeny int
}

func ConnectDevice

func ConnectDevice(endpoint string) (*Device, error)

Connect to a device

func GetConnectedDevices

func GetConnectedDevices() ([]Device, error)

Get the already connected adb devices

func (*Device) CheckAppRunning

func (d *Device) CheckAppRunning(appackage string) (bool, error)

Check if a app is running

func (*Device) GetAppPid

func (d *Device) GetAppPid(appackage string) (int, error)

Get the pid for a app

func (*Device) GetCurrentAppPackage

func (d *Device) GetCurrentAppPackage() (string, error)

Get the current focussed app package name

func (*Device) GetScreenResolution

func (d *Device) GetScreenResolution() (int, int, error)

Get the resolution of the screen

func (*Device) GetScreenState

func (d *Device) GetScreenState() (string, error)

Get the state of the screen (Asleep/Awake)

func (*Device) GetScreenText

func (d *Device) GetScreenText(xStart int, xEnd int, yStart int, yEnd int, whitelist string, multiline bool, textPolarity string) (string, error)

func (*Device) IsConnected

func (d *Device) IsConnected() bool

IsConnected checks if the device is currently connected via ADB

func (*Device) KillApp

func (d *Device) KillApp(appackage string) error

Force kill a running app

func (*Device) RunCommand

func (d *Device) RunCommand(command string) ([]byte, error)

Run a command on this specific device

func (*Device) StartApp

func (d *Device) StartApp(appackage string) error

Start a app using the package name

func (*Device) TapScreen

func (d *Device) TapScreen(x int, y int) error

Tap on a location on the screen

func (*Device) ToggleScreen

func (d *Device) ToggleScreen() error

Toggle the screen by simulating a press of the power button

Jump to

Keyboard shortcuts

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