-
Notifications
You must be signed in to change notification settings - Fork 514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug Report #969
Comments
Going through all the issue I think my solution might be in implementing
|
Update: I implemented this stateFunction = (bleRestoredState) => {
console.log(`[RESTORED STATE]`)
console.log(bleRestoredState)
if (bleRestoredState == null) {
console.log("BleManager was constructed for the first time.")
} else {
console.log("BleManager was restored. Check `bleRestoredState.connectedPeripherals` property.")
console.log(bleRestoredState.connectedPeripherals)
}
}
getBleManager = () => {
if (!this.bleManager) {
console.log(`--- NEW BLE MANAGER ---`);
this.bleManager = new BleManager({
restoreStateIdentifier: 'LockManager-state-id',
restoreStateFunction: this.stateFunction
});
}
return this.bleManager;
}; but in fact on each reload, |
After continuing my research; It looks like the issue occurs on reload with metro. I lost the instance of BleManager and it's what stuck my app in connected but not recoverable state. |
+1 |
I'm having the same issue. It looks like BleManager is not persisting connected devices between Metro reloads. I need to disable and reenable Bluetooth adapter to be able to scan for the same device again. |
any updates? |
+1 |
@MaximeLozach I am late to the party for this ticket 😅 I just landed exactly on the same scenario as yours:
I want to quickly reconnect, without pairing again the device. From my understanding we can use /**
* Options for the BleManager. use it for debugging and restoring the state.
*/
const options: BleManagerOptions = {
restoreStateIdentifier: "BleInTheBackground",
restoreStateFunction: (restoredState: BleRestoredState | null) => {
if (restoredState == null) {
logger.log("🆕 ~ BleManager was constructed for the first time.");
} else {
logger.log(
"💾 ~ BleManager BleManager was restored.",
restoredState.connectedPeripherals
);
}
}
}; when we create new instances with
But I have no idea on how it use |
Hi everyone |
Hi guys, |
Expected Behavior
When app or device loose connection I should be hable to see it in device scan or if I don't see it, be able to disconnect to it.
Current Behavior
Sometimes, it looks like I loose connection. I don't see my device when performing startDeviceScan().
But I can't disconnect. Result of connectedDevices([serviceUUID]) is empty and cancelDeviceConnection(deviceId) return an error saying I'm not connected to device.
My device don't change it's mac so I'm certain that my deviceId is correct.
The only way to get out of this situation I found is to shutdown bluetooth on my phone et put it back on. After that I'm able to see my device with startDeviceScan().
Steps to Reproduce
It's not something I can reproduce with precise steps but it goes on "disconnected" state when I don't do anything for several minute or sometimes when I reload with metro.
And I can only know I'm on this state by trying to scan or disconnect and it doesn't work.
Context
The text was updated successfully, but these errors were encountered: