Issues creating app to change Beacon Settings

I am trying to create an app to change the settings on some Estimote Stickers,but I’m failing to understand how to send the ConfigurableDevice object to the DeviceConnectionProvider.getConnection method.

    connectionProvider = new DeviceConnectionProvider(this);
    connectionProvider.connectToService(new DeviceConnectionProvider.ConnectionProviderCallback() {
          @Override
          public void onConnectedToService() {
              // Handle your actions here. You are now connected to connection service.
              // For example: you can create DeviceConnection object here from connectionProvider.
              DeviceConnection connection = connectionProvider.getConnection(**device**);
           }
    });


scanner.scanForDevices(new ConfigurableDevicesScanner.ScannerCallback(){
    @Override
    public void onDevicesFound(List<ConfigurableDevicesScanner.ScanResultItem> devices){
        for(ConfigurableDevicesScanner.ScanResultItem item: devices){
                  ConfigurableDevice **device** = item.device;
         }
     }
});

The scanner starts in the onResume method and stops scanning in the onPause method.
The DeviceConnectionProvider is created in the onCreate method.

How do I “send” the device from the scanner to the connectionProvider?

After looking deeper into how this works, it seems the comment within the device connection provider callback is misleading and there is no need to create the device connection object within it, since it just serves as a warning to when the service is connected to the activity.

So it should be fine to create the device connection object within the scanner’s for loop, for each device it finds.

However, doing so, leads to a connection not existent error when I try to checkFirmware on the devices.

Am I missing a step in the process or is it just unstable on Android SDK?

Thanks for your feedback @Freir—pretty often things are obvious to us, b/c we wrote them, so we appreciate external point of view a lot (: In fact, we released a “Connecting to beacons” tutorial on Dev Portal yesterday—would love if you could take a look and let us know if we managed to phrase it any more clear there:

http://developer.estimote.com/managing-beacons/connecting-to-beacons/#step-2-connect-to-the-beacon-1

As for the other problem—so the way I understand it, you successfully connect to your beacon (i.e., you get the onConnected callback), but when you then call connection.checkForFirmwareUpdate, you get onError callback, and the error message is something like, “connection not existent”?

I’ve checked the new guide and it’s much clearer and easy to understand!

About the error I was getting it was simply that I forgot to apply DeviceConnection.connect(…). I made it so that onConnected would check the firmware. Now it attempts to connect to the Stickers properly but the BluetoothGATT almost always ends up not being able to connect with a Time Out error. In the single case that I did manage to connect it gave a “not supported” error when attempting to check the firmware.

My goal with all of this was trying to update the Sticker’s firmware through android, but since then I managed to get an iPhone and update them, painlessly I might add, through the Estimote app.

Awesome, thanks again for your feedback!

Not sure why such a low success rate with connecting to stickers—what Android device and Android OS version were you using?

In any case, as you found out the far-from-obvious way, firmware update is not yet supported for stickers in our Android SDK. Glad you managed to do it with the iOS app though!

I’m using a Moto G3 with Android 6.0. I only checked firmware and did not try to change any other settings. About the Bluetooth GATT timing out, I wonder if it has anything to do with Stickers requiring to be nudged in order to be detected and paired. Shaking the Sticker when trying to connect seemed to work somewhat.

Hmm, I think we’ve had a fair amount of reports about weird Bluetooth behavior on Moto GX, certainly the 1st and 2nd gens.

And yeah, now that you mention it, the time outs are almost definitely due to stickers only broadcasting connectable packets when in motion. I guess we could improve that error message as well (: