I was given a react native application to work with bluetooth headset. By using the following code I was able to detect the bluetooth device connectivity on/off and alert the end user. But addition to these I was asked to fetch the battery level and some more information and some more features to be implemented with the mobile application like control the volume level of the headset through the mobile application. Is there are any react native library which we can use for this purpose apart from the following code ?
import { NativeEventEmitter, NativeModules } from "react-native"
const BluetoothHeadsetDetectModule = NativeModules.RNBluetoothHeadsetDetect
const bluetoothHeadsetDetectEmitter = new NativeEventEmitter(
BluetoothHeadsetDetectModule
)
export default class MainScreen extends Component {
componentDidMount() {
bluetoothHeadsetDetectEmitter.addListener("onChange", ({ devices }) => {
if (devices.length && devices == "xxxx") {
}
})
}
}