# ADB tunnel

## Enable ADB Tunnel

To enable the ADB tunnel feature, you can either choose to enable it through a query parameter or by utilizing the JavaScript SDK.

### With Query Parameter

Add the `enableAdb=true` query parameter to your app or embed URL

```uri
&enableAdb=true
```

See [Query Params Reference](/platform/query-params-reference.md#enableadb) for more information.

### With JavaScript SDK

Set `enableAdb: true` in the configuration e.g.

```typescript
await client.setConfig({
    enableAdb: true,
    ...
})
```

See [Configuration](/javascript-sdk/configuration.md#enableadb) for more information.

## Usage

### With App Page

{% hint style="info" %}
One common practice is to use the ADB tunnel to connect to an Android "standalone" device, without any specific app installed. For more information see [Standalone Device](/platform/standalone-device.md).
{% endhint %}

The app page provides a simple way to retrieve the `adb` information required to connect to the device.

You can access this via your app's app link

{% code overflow="wrap" %}

```url
https://appetize.io/app/{appId|buildId|publicKey}?&enableAdb=true
```

{% endcode %}

or by going to your [Apps](https://appetize.io/apps) page, selecting `Play` on the app you want to inspect, and then toggling `Adb Tunnel` to `On`

<figure><img src="/files/9awQumwzM15K5k2zONS9" alt=""><figcaption><p>Select <code>Play</code> on the app you want to inspect</p></figcaption></figure>

<figure><img src="/files/B2Kv1rqT9fUFCYf6qBCQ" alt="Example ADB Tunnel Action Switched to On"><figcaption><p>Toggle ADB tunnel to "On"</p></figcaption></figure>

Select `Tap To Start` (or your equivalent text to start the session). A command will then be generated that you need to copy and paste in your shell environment e.g.

<figure><img src="/files/Qex9o5Ui3ODUIJ5mpvCO" alt="Example command to paste in shell environment"><figcaption></figcaption></figure>

Then, the Appetize virtual Android device will appear with `adb devices`, as if it were a device plugged into your computer via USB.

### With JavaScript SDK

You can retrieve all the information needed to start an ADB session via the `adbConnection` property

```typescript
const adbInfo = session.adbConnection
const command = adbInfo.command
```

See our JavaScript [API Reference](/javascript-sdk/api-reference.md#adbconnection) for more information.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.appetize.io/features/advanced-features/android/adb-tunnel.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
