0

我正在创建一个蓝牙应用程序,并且正在尝试收听蓝牙事件。

我正在使用 react-native-bluetooth-classic 库:
https ://kenjdavidson.com/react-native-bluetooth-classic/api-overview/

我已经成功地onDeviceRead在 android 和 iOS 上通过蓝牙设备收听,但我无法onStateChanged / onBluetoothEnabled / onBluetoothDisabled在 iOS 上收听(但我可以在 android 上收听)。

我尝试自己创建一个事件监听器来用NativeAppEventEmitterand监听这些事件DeviceEventEmitter,但它仍然不适用于 iOS。

addEventListener('BLUETOOTH_ENABLED', doSomething);
addEventListener('BLUETOOTH_DISABLED', doSomething);

可能是什么问题?

4

0 回答 0