user1007522
user1007522

Reputation: 8118

How to get the proximity

I'm having some iBeacons around here.

Now how do I know that they are far or near?

Is there a way to get that from a beacon?

I've seen this https://estimote.github.io/Android-SDK/JavaDocs/ but I don't get it how to get from a beacon that it is far or not?

Upvotes: 0

Views: 339

Answers (1)

davidgyoung
davidgyoung

Reputation: 64941

When using the open source Android iBeacon Library, this is a very simple process:

    @Override 
    public void didRangeBeaconsInRegion(Collection<IBeacon> iBeacons, Region region) {
        for (IBeacon iBeacon: iBeacons) {
            if (iBeacon.getProximity() == IBeacon.PROXIMITY_NEAR) {
                Log.d(TAG, "The beacon is near");
            }
            else if (iBeacon.getProximity() == IBeacon.PROXIMITY_FAR) {
                Log.d(TAG, "The beacon is far");
            }            
        }
    }

You can see a larger example of this in the Ranging Sample Code here.

Upvotes: 1

Related Questions