> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rebellapp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# my.getBluetoothAdapterState

> Get the current state of the Bluetooth adapter.

Use this API to get the current state of the Bluetooth adapter, including whether it's available and discovering devices.

## Parameters

| Property | Type     | Required | Description                   |
| -------- | -------- | -------- | ----------------------------- |
| success  | Function | No       | Callback on success           |
| fail     | Function | No       | Callback on failure           |
| complete | Function | No       | Callback that always executes |

## Success Callback

| Property    | Type    | Description                           |
| ----------- | ------- | ------------------------------------- |
| available   | Boolean | Whether Bluetooth is available        |
| discovering | Boolean | Whether currently discovering devices |

## Code Example

### Basic Usage

```javascript theme={null}
my.getBluetoothAdapterState({
  success(res) {
    console.log('Bluetooth available:', res.available);
    console.log('Discovering:', res.discovering);
  }
});
```

### Check Before Operations

```javascript theme={null}
Page({
  async checkBluetoothState() {
    my.getBluetoothAdapterState({
      success: (res) => {
        if (!res.available) {
          my.alert({
            title: 'Bluetooth Unavailable',
            content: 'Please enable Bluetooth to continue.'
          });
          return;
        }

        if (res.discovering) {
          console.log('Already scanning...');
        } else {
          this.startDiscovery();
        }
      }
    });
  },

  startDiscovery() {
    my.startBluetoothDevicesDiscovery({
      success: () => console.log('Started scanning')
    });
  }
});
```

### Status Display

```javascript theme={null}
Page({
  data: {
    bluetoothStatus: 'unknown'
  },

  updateStatus() {
    my.getBluetoothAdapterState({
      success: (res) => {
        let status = 'Off';
        if (res.available) {
          status = res.discovering ? 'Scanning' : 'Ready';
        }
        this.setData({ bluetoothStatus: status });
      }
    });
  }
});
```

## Related APIs

<CardGroup cols={2}>
  <Card title="my.openBluetoothAdapter" icon="bluetooth-b" href="/jsapi/device/bluetooth/my.openBluetoothAdapter">
    Initialize Bluetooth
  </Card>

  <Card title="my.onBluetoothAdapterStateChange" icon="rotate" href="/jsapi/device/bluetooth/my.onBluetoothAdapterStateChange">
    Listen for state changes
  </Card>
</CardGroup>
