Connect over Bluetooth
Find nearby devices and exchange data with them over Bluetooth Low Energy from a Bare app, on iOS, Android, macOS and Linux, with no network in between.
Recipes for talking to devices in the same room over Bluetooth Low Energy with bare-bluetooth: no Wi-Fi, no internet, no server. Every guide is built on code that already ships upstream, so you can run it as-is before you change it. For how the pieces fit together, and why each guide does what it does, see Bluetooth in Bare and Bluetooth best practices.
Build a Bluetooth chat for iOS and Android
Walk through the Bluetooth chat in bare-mobile-doctor: two phones find each other, open an L2CAP channel and exchange messages, from a React Native app with a Bare worklet.
Set up Bluetooth in a mobile app
Declare and request the iOS and Android Bluetooth permissions, link the native addons, and start the worklet only once access is granted.
Exchange data over L2CAP
Open a stream between two devices with an L2CAP channel, and hand the channel's PSM to the other side through a characteristic.
Read, write and subscribe with GATT
Scan for a service, connect, find a characteristic and trade writes for notifications.
Use platform-specific Bluetooth features
Drop down to bare-bluetooth-apple or bare-bluetooth-android for what the cross-platform API leaves out, such as reconnecting without a scan.
Last updated on