Skip to content
A reactive, interface-driven central role Bluetooth LE library for Android
Branch: master
Clone or download

RxCentralBle Build Status

RxCentralBle is a reactive, interface-driven library used to integrate with Bluetooth LE peripherals.

For those tired of writing eerily similar, yet subtly different code for every Bluetooth LE peripheral integration, RxCentralBle provides a standardized, simple reactive paradigm for connecting to and communicating with peripherals from the central role.

Check out our detailed Wiki for designs and examples for all the capabilities of RxCentralBle.

Key Features

  • Reactive; observe actions to trigger them, dispose to stop.
  • Built-in operation queue; respects the serial nature of Android's BluetoothGatt.
  • Interface-driven; customize the library with your own implementations
  • Manager-based; two managers for all connectivity and communication


RxCentralBle optimizes for the following use cases:

  • Where the ability to connect to and communicate with a Bluetooth LE peripheral is needed
  • Where the peripheral is Bluetooth 4.0 LE compliant and acts per the specification
  • Where the peripheral does not require Bluetooth 4.0 specified authentication
  • Where the peripheral is not an ultra-low power device


Available on Maven Central:

dependencies {
  implementation 'com.uber.rxcentralble:rx-central-ble:1.0.4'


The below demonstrates simple usage of RxCentralBle. Check out the Wiki for details!

Bluetooth Detection

Use the BluetoothDetector to detect the state of Bluetooth:

BluetoothDetector bluetoothDetector;
Disposable detection;

// Use the detector to detect Bluetooth state.
detection = bluetoothDetector
       enabled -> {
         // Tell the user to turn on Bluetooth if not enabled

Dispose of your subscription to stop detection.

// Stop Bluetooth detection.

Connection Management

Use the ConnectionManager to manage the lifecycle of connections to a peripheral and supply a fresh GattIO to the GattManager on every connection.

ScanMatcher scanMatcher;
ConnectionManager connectionManager;
GattManager gattManager;
Disposable connection

// Connect to a peripheral.  
connection = connectionManager
        gattIO -> {
          // Inject the latest connected GattIO into your GattManager.
        error -> {
          // Connection lost.

Dispose of your subscription to disconnect.

// Disconnect.

GATT Management

After injecting the latest connected GattIO into your GattManager, you can then queue operations and the GattManager will ensure these are executed in a serial FIFO fashion. The GattManager is thread safe, so multiple consuming threads can queue operations and they will be reliably executed in the order they are subscribed.

GattManager gattManager;
Write write;
Disposable queued;

// Queue a write operaiton.
queued = gattManager
       irrelevant -> {
         // Write was successful.
       error -> {
         // Write failed.

Dispose of your subscription to dequeue (i.e. cancel).

// Cancel the write operation if it hasn't begun execution.

Sample App

The included sample application allows you to connect to any Bluetooth LE peripheral by name and query the Generic Access, Device Information, and Battery services. Feel free to improve upon the sample and submit PRs to help the RxCentralBle community.


Copyright (C) 2018 Uber Technologies

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
You can’t perform that action at this time.