A comprehensive Android BLE (Bluetooth Low Energy) project demonstrating device-to-device communication using the standard Battery Service (UUID 0x180F). This project consists of two Kotlin-based Android applications that communicate wirelessly.
This project simulates real-world IoT communication patterns between wearable devices and companion apps:
- Phone A (BLE Peripheral): Acts as a wearable device, broadcasting battery level information
- Phone B (BLE Central): Acts as a companion app, discovering and monitoring the peripheral's battery status
BLE_Battery_Communication_Project/
├── ble_peripheral_app/ # Phone A - BLE Peripheral (Server)
│ ├── app/
│ │ └── src/main/kotlin/
│ └── build.gradle.kts
├── ble_central_app/ # Phone B - BLE Central (Client)
│ ├── app/
│ │ └── src/main/kotlin/
│ └── build.gradle.kts
└── README.md
- ✅ Advertises as BLE peripheral device
- ✅ Implements standard Battery Service (0x180F)
- ✅ Broadcasts battery level percentage
- ✅ Supports real-time battery notifications
- ✅ Configurable advertising intervals
- ✅ Scans for nearby BLE peripheral devices
- ✅ Discovers and connects to Battery Service devices
- ✅ Reads battery level characteristic
- ✅ Subscribes to live battery updates
- ✅ Displays real-time battery percentage
- ✅ Auto-reconnection support
- Language: Kotlin
- Platform: Android (API Level 21+)
- Architecture: MVVM (Model-View-ViewModel)
- BLE Protocol: Bluetooth Low Energy 4.0+
- Standard Service: Battery Service (UUID: 0x180F)
- IDE: Android Studio / VS Code
- Android SDK 21 or higher (Lollipop 5.0+)
- Bluetooth Low Energy support
- Two Android devices (or one device + emulator with BLE support)
- Location permissions (required for BLE scanning on Android)
git clone https://github.com/yourusername/ble-battery-communication.git
cd ble-battery-communicationOpen both ble_peripheral_app and ble_central_app in Android Studio or VS Code
./gradlew buildBoth apps require the following permissions (already configured in AndroidManifest.xml):
BLUETOOTHBLUETOOTH_ADMINBLUETOOTH_ADVERTISE(Android 12+)BLUETOOTH_CONNECT(Android 12+)BLUETOOTH_SCAN(Android 12+)ACCESS_FINE_LOCATION
- Install BLE Peripheral App on Device A
- Install BLE Central App on Device B
- Start Peripheral app first to begin advertising
- Launch Central app to scan and connect
- Open the Peripheral app
- Tap "Start Advertising"
- App begins broadcasting battery service
- Battery level updates automatically
- Open the Central app
- Tap "Scan for Devices"
- Select the Peripheral device from the list
- View real-time battery level updates
- Service UUID:
0000180F-0000-1000-8000-00805F9B34FB - Characteristic UUID:
00002A19-0000-1000-8000-00805F9B34FB - Properties: Read, Notify
- Data Format: Unsigned 8-bit integer (0-100%)
This project was built using the BMAD (Building with AI) Framework, following a systematic development process:
- Requirements Document - Defined project scope and objectives
- Architecture Document - Designed system components and interactions
- Epics - Broke down into major functional areas
- User Stories - Created granular, actionable tasks
- AI-Assisted Development - Implemented features with full context
- PM (Project Manager) - Requirements and planning
- SM (Scrum Master) - Epic and story creation
- DV (Developer) - Implementation
- QA (Quality Assurance) - Testing and validation
- Ensure Bluetooth is enabled on both devices
- Grant location permissions (required for BLE scanning)
- Check that Peripheral app is advertising
- Verify both devices support BLE
- Reduce distance between devices
- Restart Bluetooth on both devices
- Check Android version compatibility (API 21+)
- Go to App Settings → Permissions
- Enable Location and Bluetooth permissions
- For Android 12+, ensure nearby devices permission is granted
- Support for multiple peripheral connections
- Battery history graph visualization
- Low battery notifications
- Custom service implementation
- Background scanning support
- Persistent connection management
- Unit and integration tests
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- GitHub: @abdullahxdev
- LinkedIn: @Muhammad Abdullah
⭐ If you find this project helpful, please consider giving it a star!