mapbox-gl-native-android icon indicating copy to clipboard operation
mapbox-gl-native-android copied to clipboard

Feature Request: Add ability to pause or stop/cancel Offline Map tile downloading

Open weifageo opened this issue 5 years ago • 4 comments

I'm currently building an app for outdoor recreation so offline map functionality is considered a core feature. Depending on the complexity of the map style and the number of zoom levels requested it can cause the offline map downloads process to take a significant amount of time to complete. Some users may not want to wait this long, so it would be helpful to offer the ability to pause or stop/cancel the ongoing download process. I looked over the documentation and did not see any methods to do so, when I contacted Mapbox support they responded saying this functionality does not currently exist.

I wanted to submit a new feature request as I think the ability to pause or stop/cancel could be beneficial for the majority of projects and would make the offline map downloading process more robust.

weifageo avatar Sep 21 '20 16:09 weifageo

We're experiencing the same issue @weifageo, did you have any luck with this?

According to the mapbox docs it should be doable.

ferdicus avatar Apr 02 '21 15:04 ferdicus

Thanks for your the heads up @ferdicus! I've taken a look at the documentation and I'm able to pause the ongoing download using the following line.

offlineRegion.setDownloadState(OfflineRegion.STATE_INACTIVE);

One thing to note however is this Region Name will still appear in your list of Downloaded Regions. In order to create a cancel workflow (ie. stop the download and remove the item) I had to set the Download State as Inactive and also use the Offline Manager to Delete that specific Region for it to remove the downloaded tiles from my device.

Hope this information is helpful!

weifageo avatar Apr 06 '21 00:04 weifageo

Is this for Android or iOS?

ferdicus avatar Apr 06 '21 04:04 ferdicus

This is for Android.

weifageo avatar Apr 06 '21 04:04 weifageo