CoPilot CPIK map data download

135 Views Asked by At

I’m working on integrating CPIK with our React Native app (currently working on Android but will also be adding iOS support soon).

It’s mostly there, but the current issue I’m struggling with is the initial map data download. My code at startup uses MapDataMgr.getInstalledMaps() to see if there’s map data installed and if there’s none it calls MapDataMgr.downloadMap(). This works, and I get onMapdataUpdate() callbacks so I can display a progress bar.

The problem is when the download finishes, the map UI doesn’t work. It shows a message “map not found” with an OK button, and if I tap the OK button it changes to show a spinner but the map never appears. Also, after the download completes, getInstalledMaps() still returns an empty list. I have to restart the app and then everything will work.

Is there a way to fix the state of the UI after the download completes that doesn’t require restarting the whole app?

Is it possible to shutdown the map service and then start it again?

1

There are 1 best solutions below

0
Jason Pereira On

It appears that your logic for calling the methods is fine.

Now, all that you'll need to do is to prepackage your build with product.cfg file that need to contain the following setting:

[Download]
"PreventDataDownload"=0

This should allow CoPilot to switch over to the map UI right after you've successfully downloaded a particular map data set. This file should be placed in the default CoPilot directory on the device.