eddieowens / react-native-boundary

Native implementation of geofencing/region monitoring

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Boundary.add successfully added but event onEnter is not firing

bhalaninimesh opened this issue · comments

Boundary.add successfully added but event onEnter is not firing

Which OS? If it's Android, I'm currently working on a fix.

@eddieowens
Thanks for looking into this matter.
No it is not in android it is in ios i dont know what is an issue if i mistaked installing or something else.
Please help me to find out the solution

Can you describe exactly what you're doing? Are you getting an error in the iOS logs? Are you getting logs on the JS side?

I am getting a log from JS side but onEnter event is not triggering

Boundary.add({
lat: lat,
lng: lng,
radius: 5000, // in meters
id: "pickUpFench"
})
.then(() => {
console.log("Successfully add"); // i am getting this log
// this.setEvent();
})
.catch(err => {
console.log(err);
});

Boundary.on(Events.ENTER, ids => {
  // Prints 'Get out of my Chipotle!!'
  // this.bookingUpdate("Arrived");    // but i am not getting i am already in geofence. not triggring 
  console.log(ids);
  alert(`Entered in fench ${ids[0]}`);
  console.log(`Get out of my ${ids[0]}!!`);
});

Boundary.on(Events.EXIT, ids => {
  // Prints 'Ya! You better get out of my Chipotle!!'
  alert(`Exit in fench ${ids[0]}`);

  console.log(`Ya! You better get out of my ${ids[0]}!!`);
});

I am not getting Events.ENTER event log I already in geofence so , initially it is not triggering

@eddieowens
Can I get an initially event if I am already in geofence?

@bhalaninimesh This is a limitation of iOS. The geofence library for iOS does not trigger an event for a monitored region if you are already in it (since technically you haven't entered it or exited it).