# Bluetooth - Android

{% hint style="info" %}
You'll need to import the javascript file in your website before starting from this [link](/javascript-apis/getting-started.md).
{% endhint %}

{% tabs %}
{% tab title="Plain Javascript" %}
{% code overflow="wrap" %}

```
const { Bluetooth } = window.WTN

//To start scanning for bluetooth devices
Bluetooth.startBluetoothScan({
    callback: function(data){
        //Contains data which has a list of available bluetooth devices
    }
})


//To connect bluetooth device with specific address
Bluetooth.pairDevice({
    address, //Device address that you want to connect
    timeout, //Time till the app should try to connect before returning not paired status
    callback: function(data){
        //Contains data which has result as PAIRED | NOT_PAIRED
    }
})


//To disconnect from the connected bluetooth device
Bluetooth.startBluetoothScan({
    address, //Device address that you want to connect
    callback: function(data){
        //Contains data which has result UNPAIRED | ERROR DURING UNPAIRING
    }
})
```

{% endcode %}
{% endtab %}

{% tab title="ES5+" %}

```
import { Bluetooth } from "webtonative";

//To start scanning for bluetooth devices
Bluetooth.startBluetoothScan({
    callback: function(data){
        //Contains data which has a list of available bluetooth devices
    }
})


//To connect bluetooth device with specific address
Bluetooth.pairDevice({
    address, //Device address that you want to connect
    timeout, //Time till the app should try to connect before returning not paired status
    callback: function(data){
        //Contains data which has result as PAIRED | NOT_PAIRED
    }
})


//To disconnect from the connected bluetooth device
Bluetooth.startBluetoothScan({
    address, //Device address that you want to connect
    callback: function(data){
        //Contains data which has result UNPAIRED | ERROR DURING UNPAIRING
    }
})
```

{% endtab %}
{% endtabs %}


---

# 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.webtonative.com/javascript-apis/bluetooth-android.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.
