[Android] Peripheral not found when retrieving Services
See original GitHub issueVersion
Tell us which versions you are using:
- react-native-ble-manager v6.6.8
- react-native v59.8
- iOS/Android Android v.25
Expected behaviour
Should return peripheralInfo, as it always did, and still does on iOS.
Actual behaviour
Returns “Peripheral not found”
Steps to reproduce
- Connect to device
- Call retrieveServices
Stack trace and console log
I debugged already the Android code, but can’t find the reason, why it is not working. The peripherals Map<> is always empty. When a peripheral gets discovered, it is added to the peripherals Map. But when retrieveServices() gets invoked, the Map is always empty. Can someone reproduce the issue?
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Android : UUID of Custom Service of my BLE peripheral is not ...
One of My application is working as a Bluetooth peripheral, I add one Custom Service and 3 characteristics in it.
Read more >Raspberry Pi 3B+ BLE peripheral : Android can't retrieve ...
I saw this topic : Bluetooth low energy gatt services not found on Android but I'm not using my own app for the...
Read more >Bluetooth permissions - Android Developers
If your app looks for Bluetooth devices, such as BLE peripherals, declare the BLUETOOTH_SCAN permission. If your app makes the current device discoverable...
Read more >react-native-ble-manager - npm
Note · Remember to use the start method before anything. · If you have problem with old devices try avoid to connect/read/write to...
Read more >BLE peripheral giving null for per… | Apple Developer Forums
If we start scan giving null instead of service UUID, its hitting didDiscover multiple times giving the subsequent call giving peripheral name. but...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you so much for this, this just really helped us out. This should be in the documentation of the scan or retrieveServices function, as many people are likely performing continuously looping scans which will cause problems here.
@BaloMueller I found the root cause for my case.
I was calling startScan at every scan stop event if no devices was already connected. The problem was that the setState I was calling right after the connection was not fast enough to prevent the startScan to be called again. As I can see from the native code the “peripherals” map will be empty whenever a new scan starts