Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
F

FastBle

> 编程语言
Open source

Android Bluetooth Low Energy (BLE) Fast Development Framework. It uses simple ways to filter, scan, connect, read ,write, notify, readRssi, setMTU, and multiCon

5.5K stars0 likes0 views
WebsiteGitHub

About

Android Bluetooth Low Energy (BLE) Fast Development Framework. It uses simple ways to filter, scan, connect, read ,write, notify, readRssi, setMTU, and multiCon

--- ## Table of Contents - [Features](#features) - [Requirements](#requirements) - [Preview](#preview) - [Getting Started](#getting-started) - [Usage](#usage) - [Init](#init) - [Scan](#scan) - [Connect](#connect) - [Notify / Indicate](#notify--indicate) - [Read / Write](#read--write) - [RSSI / MTU](#rssi--mtu) - [Other APIs](#other-apis) - [Changelog](#changelog) - [Star History](#star-history) - [Contact](#contact) - [License](#license) --- ## Features - Scan with custom filter rules (name / MAC / UUID) - Multi-device simultaneous connections - Read, write, notify, indicate operations - Signal strength (RSSI) reading & MTU configuration - Auto reconnection with configurable retry count and interval - Configurable timeouts for connect & operations - Modern `BluetoothLeScanner` + `ScanCallback` API internally - Supports Android 5.0 ~ 15 (API 21 ~ 35) ## Requirements | Item | Minimum | |:-----|:--------| | Android SDK | API 21 (Android 5.0) | | Java | 17 | | Android Studio | Ladybug (2024.2) or later | ## Preview

## Getting Started ### Gradle **Step 1.** Add JitPack to your root `build.gradle` (or `settings.gradle`): ```gradle allprojects { repositories { ... maven { url 'https://jitpack.io' } } } ``` **Step 2.** Add the dependency: ```gradle dependencies { implementation 'com.github.Jasonchenlijian:FastBle:2.5.0' } ``` ### Permissions FastBle declares all required permissions in its own manifest. **You do NOT need to add them again.** However, you **must** request runtime permissions before scanning: ``` … ``` > **Note:** On Android 6.0 ~ 11, GPS must be enabled for BLE scanning. On Android 12+, this is no longer required. ## Usage ### Init ```java BleManager.getInstance().init(getApplication()); BleManager.getInstance() .enableLog(true) .setReConnectCount(1, 5000) .setSplitWriteNum(20) .setConnectOverTime(10000) .setOperateTimeout(5000); ``` ### Scan ``` … ``` ### Connect ``` … ``` ### Notify / Indicate ``` … ``` ### Read / Write ``` … ``` > **Tip:** Data longer than 20 bytes is automatically split into packets. Use `write(bleDevice, uuid_service, uuid_write, data, split, callback)` to control this behavior. ### RSSI / MTU ```java // Read signal strength (device must be connected) BleManager.getInstance().readRssi(bleDevice, new BleRssiCallback() { @Override public void onRssiSuccess(int rssi) { } @Override public void onRssiFailure(BleException exception) { } }); // Set MTU (range: 23 ~ 512, requires device support) BleManager.getInstance().setMtu(bleDevice, mtu, new BleMtuChangedCallback() { @Override public void onMtuChanged(int mtu) { } @Override public void onSetMTUFailure(BleException exception) { } }); ``` ### Other APIs | Method | Description | |:-------|:------------| | `isSupportBle()` | Check if device supports BLE | | `enableBluetooth()` | Enable Bluetooth (deprecated on Android 13+) | | `getAllConnectedDevice()` | Get all connected devices | | `isConnected(bleDevice)` | Check connection state | | `getConnectState(bleDevice)` | Get detailed connection state | | `getBluetoothGatt(bleDevice)` | Get BluetoothGatt object | | `getBluetoothGattServices(bleDevice)` | Get all services | | `getBluetoothGattCharacteristics(service)` | Get all characteristics | | `disconnect(bleDevice)` | Disconnect a device | | `disconnectAllDevice()` | Disconnect all devices | | `destroy()` | Release all resources | | `convertBleDevice(bluetoothDevice)` | Convert to BleDevice object | | `requestConnectionPriority(bleDevice, priority)` | Request connection priority | ## Changelog ### v2.5.0 - **Build:** Gradle 8.13, AGP 8.5.0, compileSdk/targetSdk 35, minSdk 21, Java 17 - **Android 12+:** Add `BLUETOOTH_SCAN` / `BLUETOOTH_CONNECT` runtime permissions - **Scan API:** Replace deprecated `startLeScan()` with `BluetoothLeScanner` + `ScanCallback` - **Thread safety:** Use `ConcurrentHashMap` for GATT callback maps - **Bug fixes:** Null device name crash, `SplitWriter` cleanup order, `Parcel.readParcelable` deprecation - **Cleanup:** Remove unnecessary API version checks (minSdk is now 21) ## Star History ## Contact | Channel | | |:--------|:-| | WeChat | chenlijian1216 | | Email | [email protected] | ## License ``` Copyright 2016 chenlijian 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 http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ```

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Javaandroidblebluebluetooth

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言