Estimote / Android-Fleet-Management-SDK

Estimote Fleet Management SDK for Android
https://developer.estimote.com
MIT License
836 stars 451 forks source link

Edit beacon and send new data to Cloud Estimote #202

Closed CrossPT closed 7 years ago

CrossPT commented 7 years ago

Hi. I have a few questions for the SDK that's a little confusing.

1) It's not understandable in the SDK how to update beacon and then synchronize the new added info to the cloud. I'm using SettingsEditor to do the changes and then commit(). Does this updates the info of the beacon to the Cloud.estimote? Or I have first to edit the Cloud.estimote and then use the DeviceConnection.SyncSettings?

2) I have a few beacons that I want to update using custom info provided by my platform (custom iBeacon parameters and Eddystone URL). I'm using an Async Task that does a for loop of a list of ConfigurableDevices and then inserting my custom changes to each beacon. How can I wait for the API Callbacks to be completed before advancing to the next beacon?

Best regards

pawelDylag commented 7 years ago

Hello @CrossPT !

  1. All changes applied via our SDK automatically updates our Cloud - no need to worry about this :)
  2. We just released a new BulkUpdater - maybe it will match your use-case? Check out the quick guide here.

Let me know if that helps!

CrossPT commented 7 years ago

In the Bulk Updater SDK Javadocs you have: "This operation can be customised with firmware updates or include custom settings to write".

. Does that mean I can directly update custom settings (like uuid, major, minor) on the code or do I have to send data first to the Estimote Cloud? . Do I have to open a DeviceConnection to each beacon in order to update it?

Maybe can you provide some examples to include custom settings directly in code?

pawelDylag commented 7 years ago

Hello @CrossPT

For now there is no possibility to upload custom settings in your code (this is not fully functional, we rescheduled this feature to next version of BulkUpdater). You don't need to update anything in cloud, nor you don't need to open any connection. The BulkUpdater itself cares about establishing connections, uploading pending_settings from cloud (optionally updates firmware). It does this on defined intervals, so you can leave your phone and it will sync your devices with cloud on every interval.

If you need to update some settings, you can do this via our cloud. Just select all the beacos you wish to edit, click "Edit" and change their settings. Notice, that when changing settings for iBeacon protocol, you will be only able to edit UUID and MAJOR of multiple selected devices. The MINOR value should be changed separately - why? Because having many beacons with the same UUID, MAJOR and MINOR is just unnecessary.

Also thanks for pointing out that our BulkUpdater example is not updated - I will fix that soon :)

CrossPT commented 7 years ago

Hi again @pawelDylag.

I went back to a background service that runs a device one by one and edits it's settings. Using SettingsEditor to edit multiple params I have to wait for each callback. Is it possible to use AggregatedSettingCallback with SettingsEditor?

pawelDylag commented 7 years ago

Hey @CrossPT !

You don't need to put separate callback for each settings. You just put the one to be notified after ALL settings were applied.

Here is the example from our test suite:

   SettingsEditor editor = connection.edit();
    editor.set(connection.settings.deviceInfo.tags(), tagSet);
    editor.set(connection.settings.beacon.minor(), MINOR);
    editor.set(connection.settings.beacon.major(), MAJOR);
    editor.set(connection.settings.deviceInfo.name(), NAME);
    editor.set(connection.settings.beacon.enable(), true);
    editor.set(connection.settings.beacon.transmitPower(), TX_POWER);
    editor.set(connection.settings.beacon.proximityUUID(), uuid);
    editor.set(connection.settings.power.darkToSleep(), true);
    editor.set(connection.settings.power.darkToSleepThreshold(), DARK_TO_SLEEP_THRESHOLD);
    editor.set(connection.settings.power.flipToSleep(), false);
    editor.commit(new SettingCallback() {
      @Override
      public void onSuccess(Object value) {
        controller.nextStep();
      }

      @Override
      public void onFailure(DeviceConnectionException exception) {
        controller.stepFailed(exception);
      }
    });

All settings that failed will display log message, but won't stop the whole process. Let me know if everything is clear to you :)

maythamfahmi commented 7 years ago

I have a punch of Estimote beacons I want to update uuid, minor, major, advertising ms, txpower. I want to have an example of sdk where I am able to change those parameters, I find it a bit diffcult beacuse you have different version of sdk and diffenet example. It is a big mess for me please let me know asap

CrossPT commented 7 years ago

@maythamfahmi I ended up getting a list after X seconds of scanning. After that I iterated a list and then for each iteration I edit the beacon with the values I pre-selected on the company platform, set them into the beacon with a SettingsEditor and on the callback I iterate to the next beacon. It takes a few minutes but this allows us to register/update a bag of beacons in the company platform. It even generates at the end a report with total beacon detection and the update status for each beacon :) You can also pre-configure the beacons on the estimote cloud and then call bulk update for that list.