Created
May 4, 2020 08:59
-
-
Save Malinskiy/1512eeb0f8d34e4c2845ad4c076bb130 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Use coroutineScope | |
runBlocking { | |
//Verify the ADB server is running | |
StartAdbInteractor().execute() | |
//Create AndroidDebugBridgeServer instance | |
val adb = AndroidDebugBridgeServerFactory().apply { | |
coroutineContext = Dispatchers.IO | |
}.build() | |
//Execute requests using suspendable execute() methods. First list available devices | |
val devices = adb.execute(request = ListDevicesRequest()) | |
val serial = devices.first().serial | |
//Execute an actual command specifying serial number of device | |
val output = adb.execute(ShellCommandRequest("echo hello"), serial = serial) | |
//output == "hello" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment