Upgrading from old Android SDK to new one [offline application use case]


#1

Hello there!

I am using in my application Android-SDK, I am planning to upgrade application to Kotlin and new Android-Proximity-SDK. Before I will start and invest my effort and time I must be sure that it will perform the same as old one.

Use case:
In my application I am using only proximity monitor. I have chain of beacons [X,Y,Z] and when user enters in range of beacon X application will show notification messageX, when user enters in Y range it will show messageY with some additional data (from my API). I am not using any special stuff like tags, cloud attachments etc, only UUID, minor and major. I am using Location Beacons.

Second thing that application must support is offline mode. This is a flow:

  1. User opens application and fetch data from API (online part).
  2. User can go offline and close application.
  3. User opens application being offline, application lists cached beacon list (with uuid, minor and major seved) and then starts monitoring.
  4. User minimize application, monitoring must continue in background (it can be scanned with foreground service, with notification in drawer, it is no problem).
    I have red the documentation, section Caching data for limited internet connection use cases is not fully clear to me, I need your help!

I must be sure that it is achievable with new Proximity SDK, is it?


#2

Proximity SDK doesn’t actually use iBeacon and UUID/majors/minors, it uses Estimote Monitoring and Cloud tags instead. You’d need to reconfigure your Location Beacons => enable Estimote Monitoring on them, and tag the beacons (“X”, “Y”, etc.)

Proximity SDK caches the tags <=> identifiers of the beacons, so if the user opens the app once when online and you start monitoring for tags “X”, “Y”, then the data necessary to continue monitoring when offline will remain in cache. Note that if you tag any new beacons while offline, the SDK won’t recognize them.

With a foreground service, monitoring in the background should work just fine.


#3

Thanks for the reply! I am almost at the end of redeveloping of my application to Kotlin :). I changed also my backend logic to use Estimote Tags. In online mode everything works like a charm!

Regarding to your answer and offline mode I have some idea. If I query all the tags from my database and silently perform monitoring for each tag, how can I be sure that all necessary data is cached? Will I get some callback from Proximity SDK, when I can stop current monitoring and start another “silent monitoring” to get data cached? How to catch situation when non-existing tag is being monitored?


#4

Glad to hear that! (:

If I query all the tags from my database and silently perform monitoring for each tag, how can I be sure that all necessary data is cached? Will I get some callback from Proximity SDK, when I can stop current monitoring and start another “silent monitoring” to get data cached? How to catch situation when non-existing tag is being monitored?

I think you should already be covered in most cases:

  1. If the user starts the app for the first time when offline, and you start monitoring, you’ll get an onError callback a’la “cannot fetch data from Estimote Cloud”.
  2. If the user starts the app for the first time when online, the monitoring just starts working with all your tags and attachments.
  3. If the user starts the app when online, and tags changed since last time, monitoring will automatically pick up the latest ones.
  4. If the user starts the app when offline, and they’ve been online previously, monitoring will start with the last-known settings.

I guess the only not-covered case, not sure if that was your question or not, is when the user start the app offline, but later they go online, and in the meantime the tags changed. Then monitoring won’t use them until you re-start it. And I can’t really think of a good way to know if the tags changed or not, other than just “always restart monitoring when you detect that the user went from offline to online”, that should ensure that you’re always monitoring with the latest available data.


#5

I was thinking about different case. In my application monitoring is on demand. I have beacons connected in chains and only when user clicks on “Enable monitoring” monitoring button then applications starts scanning beacons in selected chain. I am thinking of this situation:

  1. User opens application when online and fetch all the data (scanning not performed), application have all the data in local database.
  2. User go offline and click on “Enable monitoring” which leads to run build zones and execute proximityObserver.startObserving(zoneList), but user is offline and cannot fetch data from Estimote Cloud.

To handle this situation I have to run some silent proximityObserver.startObserving(zoneList) when user is online, I am right?