frostney / react-native-ibeacon

:satellite: iBeacon support for React Native
MIT License
375 stars 54 forks source link

regionDidEnter/regionDidExit are not firing #40

Open montehansen opened 7 years ago

montehansen commented 7 years ago

Version

0.6.0 react-native-cli: 1.2.0 react-native: 0.38.0

Steps to reproduce

static get REGION ()
{
  var region =
  {
    "identifier" : "Entrance",
    "uuid" : "f1116da6-4fa2-4e11-1111-bc5b71e1111e",
    "major" : 2, // tried with and without major+minor
    "minor" : 63288
  }

  return region;
}
DeviceEventEmitter.addListener ( "regionDidEnter", (region) =>
{
  console.log( "***** regionDidEnter: " + JSON.stringify(region || {}, null, "\t") );
});

DeviceEventEmitter.addListener ( "regionDidExit", (region) =>
{
  console.log( "***** regionDidExit: " + JSON.stringify(region || {}, null, "\t") );
});

Beacons.requestAlwaysAuthorization();
// Beacons.requestWhenInUseAuthorization();
Beacons.startMonitoringForRegion(Entrance.REGION);
Beacons.startRangingBeaconsInRegion(Entrance.REGION);
Beacons.startUpdatingLocation();

Expected behavior

regionDidEnter/regionDidExit should fire.

Actual behavior

regionDidEnter does not to fire, or rarely does. I am using Estimote and Kontakt.IO beacons and have the same experience for both. For the Estimote, I did test using the ranging method, and the beaconsDidRange event does appear to fire and I do see change in the proximity field.

Any thoughts?

Thanks,

Monte

montehansen commented 7 years ago

Hmmm. I moved to a different location and using the same beacons have been able to get the regionXxx methods to fire. Strange. I will close but would love some insight from anyone on that regarding experiences of what I assume could be interference?

peterjuras commented 7 years ago

Just a guess, but are you sure that you went far enough away from the beacons? Even beacons that are set to a very low power can be picked up for a long distance if there is no interference.

devand123 commented 7 years ago

I'm experiencing the same. On RN 0.47.0