Manage Downloads

Use this section to manage the download tasks and installed regions. It covers how to pause, resume, cancel, or delete regional map downloads along with suggested UI states for corresponding foreground app behavior.

Managing Download Tasks

To pause a download task:

1
NGLRegionalOffline.controlDownload(forRegionId: regionId, action: .pause)

To resume a download task:

1
NGLRegionalOffline.controlDownload(forRegionId: regionId, action: .resume)

To cancel (stop) a download task:

1
NGLRegionalOffline.controlDownload(forRegionId: regionId, action: .cancel)

To delete a download task and the installed data for a region:

1
NGLRegionalOffline.controlDownload(forRegionId: regionId, action: .delete)

Download States

The following table lists down some download states, what they indicate and suggestions around how they can be complemented using relevant actions on application UI.

Swift stateMeaningRecommended UI Behavior
.queuedThe task is queuedShow progress, pause, and cancel actions
.downloadingPackageA regional package is being downloaded or installedShow progress, pause, and cancel actions
.pausedUserPaused by the userShow resume and delete actions
.pausedNetworkPaused because of network stateShow resume and delete actions
.failedStorageFilesystem, storage, or installation-related failurePrioritize storage recovery guidance
.failedOther terminal failureShow the detailed error and a retry action
.completedRegional packages and validated Preview resources are ready in the map engine (100%)Show downloaded, focus, or delete actions
.cancelledThe task was cancelledShow retry or delete actions

Concurrency, threading, and background behavior

  • Packages within one map region are downloaded and installed sequentially.

  • Different regional tasks may run concurrently. There is currently no public maximum-concurrency setting.

  • To limit network, storage I/O, and peak memory, allow no more than one or two regional downloads at a time in the application layer.

  • Public completions and listeners are delivered on the main queue and can update UIKit directly.

  • Regional downloads use a normal URLSession, not a background URLSession.

Do not assume that a download continues while the application is suspended or terminated. Check task state after returning to the foreground and allow the user to retry or resume.