Android API Overview
mainThe Android implementation of react-native-bluetooth-classic is composed of several key classes that manage the lifecycle of Bluetooth connections:
- RNBluetoothClassicModule: The bridge that manages all communication between the Android native layer and React Native.
- RNBluetoothClassicPackage: Responsible for providing
DeviceConnectionconfigurations to the module. You can provide a custom implementation viaMainApplicationorreact-native.config.js. - RNBluetoothClassicPackage.Builder: A fluent API used to create an
RNBluetoothClassicPackagewith customizedConnectionAcceptors,ConnectionConnectors, andDeviceConnections. - ConnectionAcceptor: An interface for accepting connections using the
BluetoothAdapter. The default implementation isRfcommAcceptorThreadImpl. - ConnectionConnector: An interface for initiating connections to individual devices. The default implementation is
RfcommConnectorThreadImpl. - DeviceConnection: The core class responsible for all communication between Android and the Bluetooth device. This is the primary extension point for handling different message types, formats, and middleware. Available implementations include:
DelimitedStringDeviceConnectionImplHexDeviceConnectionImpl