Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
useEffect(() => {
if (currentAppState === 'active') {
console.log('App has come to the foreground!', bleState);
BleManager.start({showAlert: true});
BleManager.checkState();
} else {
if (peripheral) {
changeCode({"type": "disconnect", "peripheral_id": peripheral.id});
BleManager.disconnect(peripheral.id);
}
setBleState("disconnected");
}
}, [currentAppState]);
checkState(){
BleManager.checkState();
}
checkState(){
BleManager.checkState();
}