mirror of
https://github.com/taigrr/adb.git
synced 2026-04-02 02:58:42 -07:00
tap and swipe replay works
This commit is contained in:
35
examples/injection/main.go
Normal file
35
examples/injection/main.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/taigrr/adb"
|
||||
)
|
||||
|
||||
var command string
|
||||
|
||||
func init() {
|
||||
// TODO allow for any input to be used as the command
|
||||
command = "ls"
|
||||
}
|
||||
|
||||
func main() {
|
||||
ctx := context.TODO()
|
||||
devs, err := adb.Devices(ctx)
|
||||
if err != nil {
|
||||
fmt.Printf("Error enumerating devices: %v\n", err)
|
||||
return
|
||||
}
|
||||
for _, dev := range devs {
|
||||
if !dev.IsAuthorized {
|
||||
fmt.Printf("Dev `%s` is not authorized, authorize it to continue.\n", dev.SerialNo)
|
||||
continue
|
||||
}
|
||||
err := dev.GoHome(ctx)
|
||||
if err != nil {
|
||||
// handle error here
|
||||
fmt.Printf("Error: %v\n", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user