Skip to main content

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.

note

See Device selector page for details.

This process is asynchronous, because AdbServerClient needs to fetch some extra information about the device from ADB Server.

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.

const adb: Adb = new Adb(transport);
Next Step

See API section for all supported ADB and ADB Server commands.