At some stage everything was working ok, but now I get (again) an error
I somehow fixed it before but cannot find what I'm doing wrong now.
My code is: (with the real api key)
setKontaktIo() {
const regionKontakt = {
identifier: 'Noam Kontakt Beacons',
uuid: 'f7826da6-4fa2-4e98-8024-bc5b71e0893e'
// major: 1 no major, all majors will be detected
// no minor provided: will detect all minors
};
connect(
'myapikey_changed_here_because_were_public',
[IBEACON, EDDYSTONE]
)
.then(() =>
configure({
scanMode: scanMode.BALANCED,
scanPeriod: scanPeriod.create({
activePeriod: 6000,
passivePeriod: 20000
}),
activityCheckConfiguration: activityCheckConfiguration.DEFAULT,
forceScanConfiguration: forceScanConfiguration.MINIMAL,
monitoringEnabled: monitoringEnabled.TRUE,
monitoringSyncInterval: monitoringSyncInterval.DEFAULT
})
)
.then(() => setBeaconRegions([regionKontakt]))
.then(() => setEddystoneNamespace())
.catch(error => console.log('appmain kontakt error', error));
// Beacon listeners
DeviceEventEmitter.addListener(
'beaconDidAppear',
({ beacon: newBeacon, region }) => {
console.log('beaconDidAppear', newBeacon, region);
if (this.props.currentBeacon.beaconID !== newBeacon.uniqueId) {
const tempBeacon = this.props.currentPlace.xsnearby.find(beacon => {
beacon.beacon.beaconID === newBeacon.uniqueId;
});
if (tempBeacon !== undefined && tempBeacon !== null) {
console.log('setting currentBeacon to found point in data');
this.props.setCurrentBeacon(tempBeacon.beacon);
}
}
}
);
DeviceEventEmitter.addListener(
'beaconDidDisappear',
({ beacon: lostBeacon, region }) => {
console.log('beaconDidDisappear', lostBeacon, region);
if (this.props.currentBeacon.beaconID === lostBeacon.uniqueId) {
Alert.alert(
'Beacon Disappear',
'You left: ' + this.props.currentBeacon.msg,
[{ text: 'OK' }],
{ cancelable: true }
);
}
}
);
}
startKontaktIoScan() {
console.log('startKontaktIoScan called');
startScanning()
.then(() => console.log('started scanning'))
.catch(error => console.log('[startScanning] error:\n', error));
}
componentDidMount() {
this.setKontaktIo();
this.startKontaktIoScan();
}
I get two errors, the first together with the next one:
[startScanning] error:
Error: Did you forget to call connect() or did the connect() call fail? The beacon manager is not connected.
at createErrorFromErrorData (C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\NativeModules.js:121)
at C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\NativeModules.js:78
at MessageQueue.invokeCallback (C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:398)
at C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:137
at MessageQueue.guardSafe (C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:314)
at MessageQueue.invokeCallbackAndReturnFlushedQueue (C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:136)
at debuggerWorker.js:70
The callback startScanning() exists in module KontaktBeacons, but only one callback may be registered to a function in a native module.
handleException @ C:\dev\devreact\noam\node_modules\react-native\Libraries\Core\ExceptionsManager.js:63
handleError @ C:\dev\devreact\noam\node_modules\react-native\Libraries\Core\InitializeCore.js:69
reportFatalError @ C:\dev\devreact\noam\node_modules\react-native\Libraries\polyfills\error-guard.js:42
__guardSafe @ C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:316
invokeCallbackAndReturnFlushedQueue @ C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:136
(anonymous) @ debuggerWorker.js:70
At some stage everything was working ok, but now I get (again) an error
I somehow fixed it before but cannot find what I'm doing wrong now.
My code is: (with the real api key)
I get two errors, the first together with the next one:
[startScanning] error: Error: Did you forget to call connect() or did the connect() call fail? The beacon manager is not connected. at createErrorFromErrorData (C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\NativeModules.js:121) at C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\NativeModules.js:78 at MessageQueue.invokeCallback (C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:398) at C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:137 at MessageQueue.guardSafe (C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:314) at MessageQueue.invokeCallbackAndReturnFlushedQueue (C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:136) at debuggerWorker.js:70
The callback startScanning() exists in module KontaktBeacons, but only one callback may be registered to a function in a native module. handleException @ C:\dev\devreact\noam\node_modules\react-native\Libraries\Core\ExceptionsManager.js:63 handleError @ C:\dev\devreact\noam\node_modules\react-native\Libraries\Core\InitializeCore.js:69 reportFatalError @ C:\dev\devreact\noam\node_modules\react-native\Libraries\polyfills\error-guard.js:42 __guardSafe @ C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:316 invokeCallbackAndReturnFlushedQueue @ C:\dev\devreact\noam\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:136 (anonymous) @ debuggerWorker.js:70
full react-native android app here: https://github.com/pashute/Noam/tree/feature/v098c