State gets Unsupported after refresh or JS crash
See original GitHub issuePrerequisites
- I am running the latest version
- I checked the documentation and found no answer
- I checked to make sure that this issue has not already been filed
Expected Behavior
After refreshing the app or having a JavaScript crash on iOS Bluetooth Adapter State should have the current state of BLE (same that it was if it wasn’t changed by an external condition).
Current Behavior
Sometimes it comes as Unsupported
even though it is PoweredOn
, it just goes back to normal if the app is killed and opened again. Happens randomly.
Is there a way to refresh the connection with hardware components?
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
- Subscribe and log BLE state changes with
onStateChange
- Connect with a BLE device
- Start monitoring data
- Toggle RN commands and press Refresh
- Notice that the state goes from Unknown to Unsupported and get stuck in this state
To have it happen it could be needed to run these steps more than once since it happens randomly.
Context
System:
OS: macOS 10.15
CPU: (4) x64 Intel(R) Core(TM) i5-4308U CPU @ 2.80GHz
Memory: 21.60 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.13.0 - /var/folders/j0/mcc56qzn2934szgsqdwslc_40000gn/T/yarn--1573647094820-0.6661912929450491/node
Yarn: 1.12.1 - /var/folders/j0/mcc56qzn2934szgsqdwslc_40000gn/T/yarn--1573647094820-0.6661912929450491/yarn
npm: 6.5.0 - ~/.nvm/versions/node/v10.13.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.1, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
Android SDK:
API Levels: 23, 24, 25, 26, 27, 28
Build Tools: 23.0.1, 23.0.3, 25.0.2, 26.0.2, 27.0.3, 28.0.2, 28.0.3
System Images: android-27 | Google Play Intel x86 Atom
Android NDK: 16.1.4479499
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5791312
Xcode: 11.1/11A1027 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.2 => 0.61.2
- Library version: 1.1.0
- Platform: iOS
Will keep adding more info as I troubleshoot this.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:7 (1 by maintainers)
Top Results From Across the Web
State gets Unsupported after refresh or JS crash #573 - GitHub
Sometimes it comes as Unsupported even though it is PoweredOn , it just goes back to normal if the app is killed and...
Read more >nodemon app crashed - waiting for file changes before starting
1. Go to the task manager 2. Then look for Node.js: Server-side JavaScript 3. Then right click on it and End task from...
Read more >Handling common JavaScript problems - MDN Web Docs
Now we'll look at common cross-browser JavaScript problems and how to fix them. This includes information on using browser dev tools to track ......
Read more >Authentication State Persistence | Firebase - Google
Supported types of Auth state persistence Indicates that the state will be persisted even when the browser window is closed or the activity...
Read more >Troubleshooting XAML Hot Reload - Visual Studio (Windows)
This troubleshooting guide includes detailed instructions that should resolve most issues that prevent XAML Hot Reload from working correctly.
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
Same issue. It has something to do with scanning the devices to soon after manager creation. 🤷 Haven’t been able to figure it out yet, but for testing purposes I’m delaying BLE functions (scan) after BleManager creation by 1s.
You should always wait for “PoweredOn” state before doing anything with a Bluetooth. You can use this call to monitor it: https://polidea.github.io/react-native-ble-plx/#blemanageronstatechange