Search code examples
ibeaconbeaconaltbeaconeddystoneandroid-ibeacon

Android Beacon Library - detect specific UUID only


The Android Beacon Library documentation describes using setBeaconLayout to match any beacon broadcasting a given BLE pattern of bytes.

This is more flexible than iOS, where we are restricted to finding only beacons for which we pass the specific UUID in advance, However, since this iOS restriction exists, I was wondering if it makes sense to impose the same limitation on ourselves in Android.

Is it possible to pass a specific UUID to setBeaconLayout or some other API so that didEnterRegion, etc. will only be called for a beacon with this specific UUID?

Examples for any protocol (AltBeacon, iBeacon, etc.) would be welcome.


Solution

  • Yes, you an add a ProximityUUID filter using the Android Beacon Library. Here's an example:

    Region region = new Region("myMonitoringRegion",
                                Identifier.parse("2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6"), 
                                null, 
                                null);
    beaconManager.startMonitoringBeaconsInRegion(region);
    

    The above will match any beacon that has proximityUUID 2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6 with any value for major and any value for minor.