3️⃣Start Download
Now that you have constructed a DownloadableRegion
, you're almost ready to go.
Customization Options
Before you call startForeground
(via FMTCStore().download
) to start the download, check out the customization parameters:
parallelThreads
(defaults to 5) The number of simultaneous download threads to runmaxBufferLength
(defaults to 200) The number of tiles to temporarily persist in memory before writing to the cacheskipExistingTiles
(defaults totrue
) Whether to avoid re-downloading tiles that have already been cachedskipSeaTiles
(defaults totrue
) Whether to avoid caching tiles that are entirely searateLimit
The maximum number of tiles that can be attempted per secondmaxReportInterval
(defaults to 1 second) The duration in which to emit at least oneDownloadProgress
event
Start Download
Before using FMTC, especially to bulk download or import/export, ensure you comply with the appropriate restrictions and terms of service set by your tile server. Failure to do so may lead to any punishment, at the tile server's discretion.
This library and/or the creator(s) are not responsible for any violations you make using this package.
For example, OpenStreetMap's tile server forbids bulk downloading: https://operations.osmfoundation.org/policies/tiles. And Mapbox has restrictions on importing/exporting from outside of the user's own device.
For testing purposes, check out the testing tile server included in the FMTC project: Testing Tile Server.
Whilst not recommended, it is possible to start and control multiple downloads simultaneously, by using a unique Object
as the instanceId
argument. This 'key' can then later be used to control its respective download instance.
Note that this option may be unstable.
Listen For Progress
The startForeground
method returns a (non-broadcast) Stream
of DownloadProgress
events, which contain information about the overall progress of the download, as well as the state of the latest tile attempt.
To reflect the information from a single event back to the user, use a StreamBuilder
, and build the UI dependent on the 'snapshots' of the stream. If you need to keep track of information from across multiple events, see Keeping Track Across Events below.
Keeping Track Across Events
In addition to display each individual event to your user, you may also need to keep track of information from across multiple DownloadProgress
events. In this case, you'll likely need to use the latestTileEvent
getter to access the latest TileEvent
object, and keep track of its properties.
For example, you may wish to keep a list of all the failed tiles' URLs.
However, there are 3 important things to keep in mind when doing this:
Last updated