Getting Started with Android
As previously described the
react-native-bluetooth-classic is installed through NPM:
$ npm install react-native-bluetooth-classic --save
Once installed auto linking will take over and all that is required is starting the application as normal. Be sure to check out the previous link if you need to customize or disable the autolinking of this (or any) module.
Auto linking performs the task of dynamically adding the default package:
to your application packages.
The primary classes that you may need to work with are:
RNBluetoothClassicPackage is responsible for providing the
DeviceConnection configuration to the
RNBluetoothClassicModule. You're able to provide your own implementation to React Native
react-native.config.js file, more information can be found in the guides.
RNBluetoothClassicPackage.Builder provides a fluent method for creating the
RNBluetoothClassicPackage. The builder is used to provide customized
DeviceConnection(s) to the RNBluetoothClassicModule
RNBluetoothClassicModule manages all communication between Android and React Native.
DeviceConnection is responsible for all the communication between Android and the device. This is where most of the customization will be made:
- Providing different event handling, middleware
- Handling different message types and formats
There are two current implementations available:
Customization of the native module is done through implementation of your own
RNBluetoothClassicPackage. For more information take a look at the package documentation or some of the guides available.