Bluetooth Classic Docs
React Native Bluetooth Classic
React Native Bluetooth Classic was developed to bridge the gaps in the available React Native Bluetooth moduless:
- https://github.com/rusel1989/react-native-bluetooth-serial
- https://github.com/nuttawutmalee/react-native-bluetooth-serial-next
are both fantastic implementations but they fall back to BLE on IOS.
Environments
The following environments are supported with React Native and this library:
IOS
Devices using bluetooth classic and MFi requires communication through the External Accessory framework. Please note that while working with this library on IOS, you'll need to become accustomed with the Apple and their MFi program.
Here are some links to check out:
Android
Android uses the standard BluetoothAdapter for communication:
Versions
The project doesn't follow semantic versioning. It started with just some random versioning in order for me to determine the actual best way to do this. The final product moving forward is going to be:
<bluetooth-classic-version>.<lowest-react-native-version>.<release-version>
so for example:
1.60.5
would be:
- React Native Bluetooth Classic v1 (breaking changes will increase)
- React Native v60.x - which will remain the current version until React Native provides breaking changes. When this occurs the next version would be
1.72.x
for example. - 5 releases within the previous grouping
Versions
The following tables contains the best version availability based on OS type and version:
Version | React Native | Android | IOS | Dev Branch |
---|---|---|---|---|
0.9.x | 0.59.9 | 4.1 (16) | IOS 9 | releases/0.9.x |
0.10.x | 0.60.0 | 4.1 (16) | IOS 9 | releases/0.10.x |
1.60.x | 0.60.0 | 8 (24) | IOS 9 | releases/1.60.x |
1.70.x | 0.70.0 | 11 () | IOS 9 | main |
With how crazy mobile development is, it may or may not be possible to use the library in lower or higher versions that those noted. I will always accept reasonable pull requests that bridge the gap between usable and required versions. This library can also be modified directly in your project and stored within your own project repository if needed.
Changes
Please see the change log for complete(ish) details.
Installation
Installation, like almost everything, is done through npm
:
$ npm install react-native-bluetooth-classic --save
Once installed autolinking will take over within your application.
With the changes in v1.0.0 it's possible that Autolinking doesn't actually work (just be prepared for that). The goal is to have it 100% working and customizable as per the React Native documentation, but until then just beware.
Manual Linking / Customization
There may be times where overriding autolinking is required, for those examples please see the specific android and ios APi(s).
Contribute
Issues / Enhancements
Feel free to submit any issues or enhancements through Github. Please follow the provided templates (respective) and provide as much information as you can:
- stack trace
- images
- example(s)/repositories
- etc.
Pull Requests
I'm always interested in how people are using this library, and will always accept new pull requests if they are well documented and provide functionality that provides substance. Since there are differenced between Android and IOS, the functionality doesn't need to be available in both (although it should be if possible); if this is the case, it should be fully documented and handled in the React Native module.
Thanks, good luck!!!