Download Offline Maps package
Maps Package is the actual downloadable and installable map content for a region. This guide covers how to register the download progress listener, monitor progress and handle any errors.
Register the progress listener first
It is recommended to register progress listeners before enqueueing a download. Register the progress listener before starting a download:
The initial listener snapshot is delivered on the main thread and may run before registration returns when called from the main thread. Subsequent callbacks are also delivered on the main thread.
Treat .completed as the only successful terminal download state.
Enqueue a download
Note that the enqueue completion only reports whether the task was accepted, it does not report the final download result. Use the progress listener to determine the final result.
Also, it is recommended to handle enqueue and transfer errors separately.
Use clearBefore: false for first downloads, retries, and downloads that should preserve existing regional data. Use clearBefore: true only when the user explicitly replaces an installed region, such as during a version update.
Understanding the two error paths
| Stage | Notification path | Example failures |
|---|---|---|
| Before enqueue | The Error? passed to the downloadRegion completion | Invalid region, region detail request failure, or duplicate active request |
| After enqueue | NGLRegionalOfflineDownloadProgress.error | Network, HTTP, filesystem, insufficient storage, invalid package, decompression, installation, or Preview validation failure |