Mapbox download offline maps on click

356 views Asked by At

I am using MapBox on my app and I have a fragment which is separate from the activity that has the map. In that fragment I have a ListView, which contains a list of region names. I want to create the option to click on the ListView and generate a download of that region. I have looked at this guide: https://www.mapbox.com/android-docs/map-sdk/overview/offline/ but that refers to downloading a specific region when activity starts.

How do I connect my ListView items with the option to download specific regions?

I have already created the LatLngBounds, metadata and OfflineTilePyramidRegionDefinition of the regions I need.

Thanks!

1

There are 1 answers

1
cammace On

Are you specifically speaking about downloading a region without actually showing the map? I'd recommend trying out the Offline Plugin @tobrun has been working on. It runs the download in the background inside a service which will allow your users to leave the app and continue downloading the region.