An Android application that acts as a bidirectional data bridge between Bluetooth Low Energy (BLE) devices and an MQTT broker.
The app supports both BLE roles:
- Peripheral (GATT Server)
- Central (GATT Client)
This allows BLE devices to publish data to MQTT topics and receive MQTT data back over BLE, with the Android device acting as the intermediary.
+-------------+ BLE +----------------+ MQTT +--------------+
| BLE Device | <--------------> | Android Bridge | <--------------> | MQTT Broker |
+-------------+ +----------------+ +--------------+
The Android app:
- Translates BLE writes & notifications into MQTT messages
- Translates MQTT messages into BLE notifications or writes
The app can operate in one BLE role at a time.
In Peripheral Mode, the Android app advertises itself and allows other BLE devices to connect to it.
graph LR
BLE[BLE Device]
APP[Android App]
MQTT[MQTT Broker]
BLE -->|WRITE or WRITE_NO_RESPONSE| APP
APP -->|Publish| MQTT
MQTT -->|Subscribed Data| APP
APP -->|NOTIFY| BLE
Service UUID
d2dfc1a2-9f53-494b-a2a1-1efd6148aa81
| Purpose | UUID | Properties |
|---|---|---|
| MQTT → BLE | 007a7899-dc76-4778-b33b-3460bf250eed |
NOTIFY |
| BLE → MQTT | eeb6d18b-863b-4fb5-81b6-a38902b985df |
WRITE, WRITE_NO_RESPONSE |
- Remote BLE device connects to the app
- Remote BLE device writes data to following characteristic exposed by the app
eeb6d18b-863b-4fb5-81b6-a38902b985df
- App publishes the received payload to the configured MQTT topic(s)
✔ Supported write types:
WRITEWRITE_NO_RESPONSE
- Remote BLE device subscribes to notifications on:
007a7899-dc76-4778-b33b-3460bf250eed
-
App subscribes to MQTT topic(s)
-
When MQTT data arrives:
- App sends it via BLE Notification
- Device receives data instantly
ℹ️ Indications are not supported (for now) , only Notifications.
| Direction | Mechanism |
|---|---|
| BLE → MQTT | Write to writable characteristic |
| MQTT → BLE | Notification on notifiable characteristic |
In Central Mode, the Android app scans for nearby BLE devices and connects to them.
This mode is ideal when:
- BLE devices already advertise services
- Android initiates and manages connections
graph LR
BLE[BLE Device]
APP[Android App]
MQTT[MQTT Broker]
BLE -->|NOTIFY or INDICATE| APP
APP -->|Publish| MQTT
MQTT -->|Subscribed Data| APP
APP -->|WRITE_NO_RESPONSE| BLE
The BLE device must expose at least one characteristic with:
NOTIFYorINDICATE
Once found, the app UI allows enabling notifications/indications.
When data arrives:
- App publishes it to the configured MQTT topic(s)
The BLE device must expose a characteristic supporting:
WRITE_NO_RESPONSE
When MQTT data arrives:
- App writes the payload to the selected characteristic
| Direction | Requirement |
|---|---|
| BLE → MQTT | Characteristic with NOTIFY or INDICATE |
| MQTT → BLE | Characteristic with WRITE_NO_RESPONSE |
The app allows configuring:
- Broker URL
- Port
- Credentials (if required)
- Publish topics
- Subscribe topics
| Source | Destination |
|---|---|
| BLE Write / Notification | MQTT Publish |
| MQTT Subscribe | BLE Notify / Write |
- Payloads are forwarded as bytes
- No transformation is applied
On devices running Android 11 (API level 30) or lower, the system requires location permission to perform Bluetooth Low Energy (BLE) scans. This is an Android platform restriction, as BLE scanning can potentially be used to infer a user’s location. To use the app in Central role and scan for nearby BLE devices, you must grant the appropriate location permission (typically ACCESS_FINE_LOCATION) and ensure that location services are turned ON on the device. If location permission is denied or location services are disabled, BLE scanning will not return any results, even if Bluetooth is enabled.










