Skip to content
Ivan Baranov edited this page Apr 24, 2017 · 8 revisions
  1. Download.

    compile 'com.github.ivbaranov:rxbluetooth:0.1.6'

Snapshots of the development version are available in Sonatype's snapshots repository.

  1. Declare permissions:

    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
  2. Create RxBluetooth instance.

  3. Check if bluetooth is currently enabled and ready for use.

    if  (!rxBluetooth.isBluetoothAvailable()) {
       // to enable blutooth via startActivityForResult()
       rxBluetooth.enableBluetooth(this, REQUEST_ENABLE_BT);
    }
  4. Have fun.

  5. Make sure you are unsubscribing and stopping discovery OnDestroy().

    if (rxBluetooth != null) {
          rxBluetooth.cancelDiscovery();
        }
    unsubscribe(rxBluetoothSubscription);