0

I have using Android Beacon Library for one of my beacon solution . I can see that if I enter the beacon range ..it calls the "didEnterRegion" function but it never enter the "didExitRegion" when I go off the beacon region . I am taking the above code which I used in here Android iBeacon App not working in the background . In addition to that is there any way I can reduce the range detection because I keep on getting that very frequently because logically I want to record the data and send the notification once if customer enter beacons in 1 mt range.

ssnegi
  • 183
  • 1
  • 1
  • 15

1 Answers1

1

In the code shown in the other question, the didEnter Region method disables monitoring with regionBootstrap.disable() If you don't want it disabled, remove that code.

@Override
public void didEnterRegion(Region arg0) {
    Log.d(TAG, "Got a didEnterRegion call");
    // This call to disable will make it so the activity below only gets launched the first time a beacon is seen (until the next time the app is launched)
    // if you want the Activity to launch every single time beacons come into view, remove this call.
    regionBootstrap.disable();
    Intent intent = new Intent(this, MainActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

    // Important:  make sure to add android:launchMode="singleInstance" in the manifest
    // to keep multiple copies of this activity from getting created if the user has
    // already manually launched the app.
    this.startActivity(intent);


}

If you don't want to send a notification until a user is < 1m, you must use the didRangeBeaconsInRegion callback, and then only fire the notification if beacon.getDistance < 1.0.

davidgyoung
  • 63,876
  • 14
  • 121
  • 204
  • Hello David , Thanks for your response. I have opened a new thread for a different question if you could answer it that would be great. ..https://stackoverflow.com/questions/45142727/how-to-increase-the-delay-in-the-data-of-the-region-notifier – ssnegi Jul 17 '17 at 11:13