Scan for any estimote without specifying any beacon (U)UID

Hey

For my project I came up with an architecture in which all beacon information is contained in a backend. This means the Android device has to scan for any Estimote beacon without looking specified (U)UID. Is this possible? Because in the tutorials I see always a UUID being defined for which the manager has to scan.

Maybe you could check the ‘Proximity Content for Multiple Beacons’ template app from https://cloud.estimote.com
You could listen all of your beacons.

I found the solution I just need to create a Region object with the UUID Major and Minor set as null. Only problem I am currently having is I can change the interval to check for when to trigger the didExitEvent by using: beaconManager.setBackgroundScanPeriod(20000,5000);
beaconManager.setRegionExitExpiration(5000);

But it only seems have made the time to notice the exit of a region longer instead of shorter.

The default scan periods and exit expiration we use are there for a reason, because we found them the best/most sensible across many, many Android devices (:

Suggest you set the scanning time shorter than sleeping time.:slight_smile:
Or it may waste more battery energy!

I found out why it took so long to detect. Apparently beaconManager.setRegionExitExpiration(5000); doubles the time you have inserted. I am currently using beaconManager.setRegionExitExpiration(10000); and the exit period is 20 seconds.

I tested on a samsung galaxy s7 running Android 6.01 and a motorola moto g 2013 running android 4.4.4. I tested using the log of Android Studio and comparing the log timestamps. As soon i turned a beacon upside I would log the beaconID and then immediately turned the beacon back upside down and log when the exit event was triggered. 9/10 times it was 20 seconds the other time it was few seconds less or more. The only difference between the devices I tested with was the speed it detected a beacon.

Here is the code I used

public class VITOBeacon extends Application {

    private BeaconManager beaconManager;

    private final long SCAN_DURATION_INTERVAL_MILLI_S = 1000;
    private final long SCAN_WAITTIME__INTERVAL_MILLI_S = 500;
    private final long EXIT_EXPIRATION_MILLI_S = 10000;
    private final Region ALL_ESTIMOTE_BEACONS = new Region("All Beacons",null,null,null);

    @Override
    public void onCreate() {
        super.onCreate();

        beaconManager = new BeaconManager(getApplicationContext());
        beaconManager.setBackgroundScanPeriod(SCAN_DURATION_INTERVAL_MILLI_S,SCAN_WAITTIME__INTERVAL_MILLI_S);
        beaconManager.setRegionExitExpiration(EXIT_EXPIRATION_MILLI_S);

        beaconManager.setMonitoringListener(new BeaconManager.MonitoringListener() {
            @Override
            public void onEnteredRegion(Region region, List<Beacon> list) {
                String iBeaconID = convertIBeaconIDToString(list.get(0).getProximityUUID(),list.get(0).getMajor(),list.get(0).getMinor());
                System.out.println(iBeaconID);
            }
            @Override
            public void onExitedRegion(Region region) {
                System.out.println("User has left the Region");
            }
        });

        beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
            @Override
            public void onServiceReady() {
                beaconManager.startMonitoring(ALL_ESTIMOTE_BEACONS);
            }
        });
    }

    private String convertIBeaconIDToString (UUID uuid, int major, int minor) {
        String iBeaconID = "";
        iBeaconID = iBeaconID.concat(uuid.toString() + "-" + Integer.toString(major) + "-" + Integer.toString(minor));
        return iBeaconID;
    }


}