Tuesday, 2 March 2021

react-native-ble-manager returns nothing or event 'handleDiscoverPeripheral' is never triggered

I'm trying to get a list of available Bluetooth devices using this example.

(I don't use emulators, I've connected the phone via USB.)

This is an official example of the code. Code is here

However, I can't see any devices. The event 'handleDiscoverPeripheral' is never triggered.

I should be able to see at least 2 devices.

This is my react native log

info Reloading app...
 BUNDLE  [android, dev] ./index.js ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (1/1), done.

 LOG  Running "ArduinoBluetooth" with {"rootTag":1}
 WARN  VirtualizedLists should never be nested inside plain ScrollViews with the same orientation - use another VirtualizedList-backed container instead.
 LOG  Permission is OK
 LOG  Scanning...
 LOG  Scan is stopped
 LOG  No connected peripherals
 LOG  []
 LOG  Scanning...

P.S I've increased seconds of scanning to 30

BleManager.scan([], 30, true)

Also, all permssions are set.

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>


from react-native-ble-manager returns nothing or event 'handleDiscoverPeripheral' is never triggered

No comments:

Post a Comment