简体   繁体   中英

AltBeacon Android Beacon Library region id is null

I'm using AltBeacon android library to detect Eddystone beacons on my app.

I'm setting the region like this:

Region region = new Region("backgroundRegion", null, null, null);

Whenever my app detects a beacon in range, I'm logging it like this:

@Override public void didEnterRegion(Region region) {
        Log.v(TAG, "didEnterRegion() called with: region = [" + region.toString() + "]");
    }

id1, id2 and id3 return null.

Instead, if I do this:

Region region = new Region("backgroundRegion", Identifier.parse("0x0b85497366bad1356d69"), null, null);

id1 returns `b85497366bad1356d69``

I want to detect all Eddystone devices. Can I get the device identifier if I do not set the region for that identifier?

The Ranging object in the callback for didEnterRegion is simply a copy of the one you used to start monitoring, so the identifiers will be all null if the initial Region has identifiers all null.

The solution? Use startRangingBeaconsInRegion() and the didRangeBeaconsInRegion callback. That callback will give you a list of detected beacons matching the region, so you can read all the actual identifiers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM