Documentation
¶
Index ¶
- type Device
- func (d *Device) AndroidVersion(ctx context.Context) (string, error)
- func (d *Device) Brand(ctx context.Context) (string, error)
- func (d *Device) GetProperties(ctx context.Context) (map[string]string, error)
- func (d *Device) GetProperty(ctx context.Context, name string) (string, error)
- func (d *Device) InputText(ctx context.Context, text string) error
- func (d *Device) InstallApp(ctx context.Context, apkPath string, reinstall, grantPermissions bool) error
- func (d *Device) ListPackages(ctx context.Context, includeSystemApps bool) ([]PackageInfo, error)
- func (d *Device) Model(ctx context.Context) (string, error)
- func (d *Device) PressKey(ctx context.Context, keycode int) error
- func (d *Device) SDKLevel(ctx context.Context) (string, error)
- func (d *Device) Shell(ctx context.Context, command string) (string, error)
- func (d *Device) StartActivity(ctx context.Context, pkg, activity string, extras map[string]string) error
- func (d *Device) StartApp(ctx context.Context, pkg, activity string) error
- func (d *Device) Swipe(ctx context.Context, startX, startY, endX, endY, durationMs int) error
- func (d *Device) TakeScreenshot(ctx context.Context, quality int) (string, []byte, error)
- func (d *Device) Tap(ctx context.Context, x, y int) error
- func (d *Device) UninstallApp(ctx context.Context, pkg string, keepData bool) error
- type DeviceInfo
- type Manager
- func (m *Manager) Connect(ctx context.Context, host string, port int) (*Device, error)
- func (m *Manager) Disconnect(ctx context.Context, serial string) error
- func (m *Manager) GetDevice(ctx context.Context, serial string) (*Device, error)
- func (m *Manager) ListDevices(ctx context.Context) ([]*Device, error)
- type PackageInfo
- type Wrapper
- func (w *Wrapper) Connect(ctx context.Context, host string, port int) (string, error)
- func (w *Wrapper) Disconnect(ctx context.Context, serial string) error
- func (w *Wrapper) GetDevices(ctx context.Context) ([]DeviceInfo, error)
- func (w *Wrapper) GetProperties(ctx context.Context, serial string) (map[string]string, error)
- func (w *Wrapper) PullFile(ctx context.Context, serial, remotePath, localPath string) error
- func (w *Wrapper) PushFile(ctx context.Context, serial, localPath, remotePath string) error
- func (w *Wrapper) RunDeviceCommand(ctx context.Context, serial string, args []string) (string, string, error)
- func (w *Wrapper) Shell(ctx context.Context, serial, command string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
Device 表示一个 Android 设备
func (*Device) AndroidVersion ¶
AndroidVersion 获取 Android 版本
func (*Device) GetProperties ¶
GetProperties 获取设备所有属性
func (*Device) GetProperty ¶
GetProperty 获取设备特定属性
func (*Device) InstallApp ¶
func (d *Device) InstallApp(ctx context.Context, apkPath string, reinstall, grantPermissions bool) error
InstallApp 安装 APK 应用
func (*Device) ListPackages ¶
ListPackages 列出已安装的包
func (*Device) StartActivity ¶
func (d *Device) StartActivity(ctx context.Context, pkg, activity string, extras map[string]string) error
StartActivity 启动应用活动
func (*Device) TakeScreenshot ¶
TakeScreenshot 截屏
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager 设备管理器
func (*Manager) Disconnect ¶
Disconnect 断开设备连接
type PackageInfo ¶
PackageInfo 包信息
type Wrapper ¶
type Wrapper struct {
// contains filtered or unexported fields
}
Wrapper ADB 命令包装器
func (*Wrapper) Disconnect ¶
Disconnect 断开设备连接
func (*Wrapper) GetDevices ¶
func (w *Wrapper) GetDevices(ctx context.Context) ([]DeviceInfo, error)
GetDevices 获取连接的设备列表
func (*Wrapper) GetProperties ¶
GetProperties 获取设备属性
Click to show internal directories.
Click to hide internal directories.