Create transport
Create transport for a device
declare class AdbServerClient {
createTransport(
device: AdbServerClient.DeviceSelector
): Promise<AdbTransport>;
}
The AdbServerClient#createTransport
method creates an AdbTransport
for the specified device. The device must have already been authenticated.
It accepts a Device selector value to specify the target device. Device selectors allow you to select a specific device in multiple ways.
In this tutorial, we will use the AdbServerClient.Device
object we got from the previous step as a Device selector. In fact, this is the best (most precise) way to select a device.
See Device selector page for details.
This process is asynchronous, because AdbServerClient
needs to fetch some extra information about the device from ADB Server.
- JavaScript
- TypeScript
const transport = await client.createTransport(device);
import { AdbTransport } from "@yume-chan/adb";
const transport: AdbTransport = await client.createTransport(device);
Create an Adb instance
The transport object only contains the lower-level logic to communicate with devices, the Adb
class provides a higher-level abstraction over ADB protocol and ADB commands.
- JavaScript
- TypeScript
const adb = new Adb(transport);
const adb: Adb = new Adb(transport);
See API section for all supported ADB and ADB Server commands.