{"id":28604021,"url":"https://github.com/uber/rxcentralble","last_synced_at":"2025-07-23T15:05:20.144Z","repository":{"id":33921939,"uuid":"156879211","full_name":"uber/RxCentralBle","owner":"uber","description":"A reactive, interface-driven central role Bluetooth LE library for Android","archived":false,"fork":false,"pushed_at":"2022-02-09T18:09:39.000Z","size":331,"stargazers_count":199,"open_issues_count":5,"forks_count":21,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-06-11T18:06:29.457Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uber.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-09T15:15:22.000Z","updated_at":"2025-01-07T05:32:48.000Z","dependencies_parsed_at":"2022-08-07T23:30:44.243Z","dependency_job_id":null,"html_url":"https://github.com/uber/RxCentralBle","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/uber/RxCentralBle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2FRxCentralBle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2FRxCentralBle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2FRxCentralBle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2FRxCentralBle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uber","download_url":"https://codeload.github.com/uber/RxCentralBle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2FRxCentralBle/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266699565,"owners_count":23970514,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-11T17:40:11.635Z","updated_at":"2025-07-23T15:05:20.110Z","avatar_url":"https://github.com/uber.png","language":"Java","readme":"\u003cp\u003e\u003cimg src=\"https://d183q68ssszldn.cloudfront.net/rx_central_logo.png\" width=\"100\"/\u003e\u003c/p\u003e\n\n# RxCentralBle ![Build](https://github.com/uber/RxCentralBle/workflows/CI/badge.svg)\n\nRxCentralBle provides a simple reactive paradigm for connecting to and communicating with Bluetooth LE peripherals from the central role. It is ideal for all applications - in particular those that require multiple concurrent Bluetooth LE integrations.\n\nRxCentralBle avoids many known Android pitfalls, including limitations in Android 7 \u0026 8 around scanning operations, serial FIFO queueing for GATT, and others.\n\nRxCentralBle powers Uber's Bluetooth LE integrations on Android, including the next-generation [Uber Beacon](https://uber.com/beacon).\n\nNEW! Uber Engineering Blog [article](https://eng.uber.com/rxcentral-bluetooth-connection-library-rxcentralble/) detailing RxCentral cross-platform design and techniques for Android.\n\nCheck out the equivalent iOS library: [RxCBCentral](https://github.com/uber/RxCBCentral).\n\n## Key Features\n\n  - Reactive; subscribe to actions to trigger them, dispose to stop\n  - Built-in operation queue; respects the serial nature of Android's BluetoothGatt\n  - Built-in GATT write segmentation; all writes are automatically chunked into MTU-sized segments\n  - Interface-driven; customize the library with your own implementations\n  - Manager-based; two managers for all connectivity and communication\n\n## Applicability\n\nRxCentralBle optimizes for the following use cases:\n\n  - Where the ability to connect to and communicate with a Bluetooth 4.0+ LE peripheral is needed\n  - Where the peripheral is Bluetooth 4.0+ LE compliant and acts per the specification\n  - Where the peripheral does not require Bluetooth 4.0 specified authentication\n\n## Download\n\nAvailable on Maven Central:\n\n```gradle\ndependencies {\n  implementation 'com.uber.rxcentralble:rx-central-ble:1.2.2'\n}\n```\n\n## Usage\n\nThe below demonstrates simple usage of RxCentralBle.  Check out the [Wiki](https://github.com/uber/RxCentralBle/wiki) for details!\n\n### Bluetooth Detection\n\nUse the BluetoothDetector to detect the state of Bluetooth:\n\n```java\nBluetoothDetector bluetoothDetector;\nDisposable detection;\n\n// Use the detector to detect Bluetooth state.\ndetection = bluetoothDetector\n   .enabled()\n   .subscribe(\n       enabled -\u003e {\n         // Tell the user to turn on Bluetooth if not enabled\n       }\n   );\n   \n```\n\nDispose of your subscription to stop detection.  \n\n```java\n// Stop Bluetooth detection.\ndetection.dispose();\n```\n\n### Connection Management\n\nUse the ConnectionManager to manage the lifecycle of connections to a peripheral and supply a fresh Peripheral to the PeripheralManager on every connection.\n\n```java\nScanMatcher scanMatcher;\nConnectionManager connectionManager;\nPeripheralManager peripheralManager;\nDisposable connection\n\n// Connect to a peripheral.  \nconnection = connectionManager\n    .connect(scanMatcher, DEFAULT_SCAN_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT)\n    .subscribe(\n        peripheral -\u003e {\n          // Inject the latest connected Peripheral into your PeripheralManager.\n          peripheralManager.setPeripheral(peripheral);\n        },\n        error -\u003e {\n          // Connection lost.\n        };\n```\n\nDispose of your subscription to disconnect.  \n\n```java\n// Disconnect.\nconnection.dispose();\n```\n\nBecause this is a reactive library, you can leverage Rx retries to attempt to reconnect to a peripheral if a scan fails.\n\n```java\nScanMatcher scanMatcher;\nConnectionManager connectionManager;\nPeripheralManager peripheralManager;\nDisposable connection\n\n// Support retries for connection. \nconnection = connectionManager\n    .connect(scanMatcher, DEFAULT_SCAN_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT)\n    .retryWhen(\n        errorObservable -\u003e \n            // Custom retry logic\n    )\n    .subscribe(\n        peripheral -\u003e {\n          // Inject the latest connected peripheral into your PeripheralManager.\n          peripheralManager.setPeripheral(peripheral);\n        };\n```\n\n### Peripheral Management\n\nAfter injecting the connected Peripheral into your PeripheralManager, you can then queue operations and the PeripheralManager will ensure these are executed in a serial FIFO fashion.  The PeripheralManager is thread safe, so multiple consuming threads can queue operations and they will be reliably executed in the order they are subscribed.\n\n```java \nPeripheralManager peripheralManager;\nWrite write;\nDisposable queued;\n\n// Queue a write operaiton.\nqueued = peripheralManager\n  .queueOperation(write))\n  .subscribe(\n       irrelevant -\u003e {\n         // Write was successful.\n       },\n       error -\u003e {\n         // Write failed.\n       });\n```\n\nDispose of your subscription to dequeue (i.e. cancel).  \n\n```java       \n// Cancel the write operation if it hasn't begun execution.\nqueued.dispose();\n```\n\n## Sample App\n\nThe 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.\n\n## License\n\n    Copyright (C) 2018 Uber Technologies\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuber%2Frxcentralble","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuber%2Frxcentralble","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuber%2Frxcentralble/lists"}