Hi,
I am creating a React Native app, using the @estimote/react-native-proximity plugin, however the RNEP.ProximityZone actions for OnEnterAction, OnExitAction and OnChangeAction are never fired.
I bought a starter kit and have registered all 3 UWB Proximity Beacons in Estimote Cloud. I have assigned different tags to all 3 beacons. I am only trying to setup one beacon below, to get it working first before adding the other zones.
Im requesting the relevant permissions on app load, have started Observing Zones but none of the actions are fired. I’ve set the distance to 1 metre so ease but no actions are being fired.
Here is my code:
const startProximityObserver = () => {
const ESTIMOTE_APP_ID = xxx;
const ESTIMOTE_APP_TOKEN = xxx;
const beaconList = [
{
bec_id: 1001,
bec_uuid:xxx,
str_id: 4005,
bec_name: ‘lemon’,
loc_id: xxx,
id: 1,
tag: ‘bedroom’,
}
];
if (beaconList.length) {
RNEP.locationPermission.request().then(
permission => {
if (permission !== RNEP.locationPermission.DENIED) {
const credentials = new RNEP.CloudCredentials(ESTIMOTE_APP_ID, ESTIMOTE_APP_TOKEN);
const config = {
notification: {
title: ‘Exploration mode is on’,
text: “We’ll notify you when you’re next to something interesting.”,
channel: {
id: ‘exploration-mode’,
name: ‘Exploration Mode’
}
}
};
var zones = ;
for (var i = 0; i < beaconList.length; i++) {
var zone = new RNEP.ProximityZone(1, beaconList[i].tag);
zone.onEnterAction = onZoneEntered;
zone.onExitAction = onZoneExit;
zone.onChangeAction = onZoneChanged;
zones.push(zone);
}
RNEP.proximityObserver.initialize(credentials, config);
if (zones.length) {
RNEP.proximityObserver.startObservingZones(zones);
}
}
},
error => {
console.error(‘Error when trying to obtain location permission’, error);
}
);
}
const onZoneEntered = context => {
console.log(‘zone onEnter’, context);
};
const onZoneExit = context => {
console.log(‘zone onExit’, context);
};
const onZoneChanged = contexts => {
console.log(‘zone onChange’, contexts);
};
};
I’ve spent 3 days on this now, the code is really straight forward and should work out the box.
Have I got the correct beacons?? UWB Proximity Beacons - GG_2.2fc
If you could get back to me ASAP that would be great!