Secure UUID Ranging

I am trying to print out the list of Secure UUID beacon objects as a string. The list comes up empty if I do this with SecureRegion. It works just fine with Region (commented).

From what I read it should just be a matter of enabling the Secure UUID on the beacons through the web page, Initializing the SDK with the ID and Token and then switch from Region to SecureRegion.

What am I doing wrong?

Here is my code:

public class MainActivity extends AppCompatActivity {

    private BeaconManager beaconManager;
    private SecureRegion secureRegion;
    //private Region region;
    private String appID = "XXXX"; //from Apps>App Settings (Estimote webpage)
    private String appToken = "XXXX"; //from Apps>App Settings (Estimote webpage)

    public void printOut(String textToPrint){
        TextView textView = (TextView)findViewById(R.id.text);
        textView.setText(textToPrint);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        EstimoteSDK.initialize(getApplicationContext(), appID, appToken);
        beaconManager = new BeaconManager(getApplicationContext());
        beaconManager.setForegroundScanPeriod(1000, 0);
        secureRegion = new SecureRegion("Secure region", null, null, null);
        //region = new Region("Region", null, null, null);

        beaconManager.setRangingListener(new BeaconManager.RangingListener() {

            @Override
            //public void onBeaconsDiscovered(Region region, List<Beacon> list) {
            public void onBeaconsDiscovered(Region secureRegion, List<Beacon> list) {
                Log.d("log", "onBeaconsDiscovered");
                if (!list.isEmpty()) {
                    Log.d("log", "!list.isEmpty()" );
                    printOut(list.toString());
                }
            }
        });
    }

    @Override
    protected void onResume() {
        super.onResume();
        SystemRequirementsChecker.checkWithDefaultDialogs(this);
        beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
            @Override
            public void onServiceReady() {
                //beaconManager.startRanging(region);
                beaconManager.startRanging(secureRegion);
            }
        });
    }

    @Override
    protected void onPause() {
        //beaconManager.stopRanging(region);
        beaconManager.stopRanging(secureRegion);
        super.onPause();
    }

}

Thank you!

Make sure that Secure UUID on your beacons is actually enabled.

If you edited your beacons on cloud.estimote.com, turning Secure UUID on, then you still need to open the Estimote iOS app in range of the beacons for the pending changes to be applied.

Thank you for the quick reply!
Unfortunately, i wish it were something that simple. I have 3 beacons that are Secure UUID enabled. I can verify this through both the Android app and the Estimote cloud page. I initially enabled them through the Android App.

Managed to find the root cause of the problem. There was a bug in the Estimote Android app. We fixed it in version 1.5.0, so if anyone experiences anything similar, the solution is to update to the latest version and re-enable Secure UUID on your beacons.

Many thanks to @marcus for helping us in tracking this one down! (:

​The version i have on my android phone this morning was 1.5.3. So it updated on its own through the google play store. I was unable to connect to any of the secured beacons at all through the android app until i used the Apple app to turn off SecureUUID and then turn it back on. At this point I was able to connect to them with both the android app and the code in my original post.

You can consider this issue resolved on my end.

Thank you so much for your help.

Marcus

A bit weird you weren’t able to connect to them with the Android app, but the iOS app worked—I’d actually expect this bug to affect it the other way around, i.e., prevent the iOS app from being able to connect. Any chance you remember to error message in the Android app?

In any case, glad it’s resolved now, and really sorry for the trouble!

I have faced same issue for Android SDK(dependencies compile ‘com.estimote:sdk:0.9.4@aar’ ).
The onEnteredRegion and onExitRegion does not fire with secureRegion.
I have changed beacon configuration ( Turned on Secure UUID ) from Estimote IOS app.
The Region working fine but the SecureRegion does not working any more.

Please get rid out of it.

Can you try updating to latest SDK? I think we fixed that since 0.9.4.

Ok.Let me try with new Android SDK version.