PDA

View Full Version : Understanding CONNECTIVITY_MODE_OFFLINE time to set



makzimi
09.06.2015, 13:10
Hello,

I'm trying to implement only offline mode for my Android App. That means I would like to download any package and show it on the map. And one necessary thing is to set CONNECTIVITY_MODE_OFFLINE like this:

SKMaps.getInstance().setConnectivityMode(SKMaps.CO NNECTIVITY_MODE_OFFLINE);
But I have this question - When should I do that? If I do it right after initialization

SKMaps.getInstance().initializeSKMaps(context, initMapSettings);
then my downloaded (in the future) maps didn't show up. And no cities and country labels on the map. I suppose SKMaps doesn't have time to download this information. If I set CONNECTIVITY_MODE_OFFLINE sometime in future - than it's OK, I can see only downloaded maps. But it is just my guess, when to set this mode.

So when exactly should I set CONNECTIVITY_MODE_OFFLINE so important data has time to be downloaded?


Maxim.

Adela_Silvia
10.06.2015, 17:15
Hi Maxim,

You should set the offline mode after getting the MetaData callback (You have to be sure that metadata is downloaded before adding the package. SKMetaDataListener provides a callback (public void onMetaDataDownloadFinished(int versionNumber) ) that tells you when these meta files are ready. Only after receiving this callback the map can be successfully rendered. (SKVersioningManager has a property called setMetaDataListener that you can use to verify) You’ll find this info also in the getting started documentation: http://developer.skobbler.com/getting-started/android#sec022a).

You have to be sure that metadata is downloaded before adding the package.
SKMetaDataListener provides a callback (public void onMetaDataDownloadFinished(int versionNumber) ) -tells you when these meta files are ready. Only after receiving this callback the map can be successfully rendered.

Let us know if you need further help.

makzimi
10.06.2015, 23:40
Hi Adela,

Thank you so much for such detailed answer!