Search code examples
ibeaconeddystone

Android Beacon Library Reference Application Help (didEnterRegion function)


My region is:

Region region = new Region("backgroundRegion", Identifier.parse("24DDF411-8CF1-440C87CD-E368DAF9C93E"), null, null);

When I start the program I get this message:

06-26 18:03:21.061 7394-7394/? D/BeaconReferenceApp: setting up background monitoring for beacons and power saving

But it doesn't enter in any didEnterRegion function

So, I removed this line: backgroundPowerSaver = new BackgroundPowerSaver(this);

And change scanning times, as it follows:

beaconManager.setBackgroundScanPeriod(1100l);
beaconManager.setBackgroundBetweenScanPeriod(10000l-1100l);

I checked my Beacon UUID and they are 24DDF411-8CF1-440C87CD-E368DAF9C93E

So what is wrong? Why the app doesn't go to the didEnterRegion function?

I already made it work to work with other than AltBeacons... (ranging function works ok!)

My final goal is to get current time when a beacon is discovered...


Solution

  • A few possibilities:

    1. If you are already in the beacon region, you won't get a second callback until the beacon disappears (turn it off for 30 seconds or so, then turn it back on while the app is running.) Alternatively, you can look for a call do didDetermineStateForRegion which is always called when your app starts up, with a flag that tells you if you are inside or outside.

    2. Make sure you have granted runtime permissions to location.

    3. Make sure location is turned on for your phone in settings.

    4. Make sure the beacon is transmitting that identifier using the Locate app https://play.google.com/store/apps/details?id=com.radiusnetworks.locate&hl=en

    5. Make sure you have the proper BeaconParser configured. The question is tagged Eddystone, but shows an iBeacon or AltBeacon-style UUID as the first identifier. Do you have a custom beacon parser configured? What beacon type are you trying to detect?