A task to synchronize an offline map's geodatabases with its originating sync-enabled ArcGIS feature services. More...
Header: | #include <OfflineMapSyncTask.h> |
Since: | Esri::ArcGISRuntime 100.1 |
Inherits: | Esri::ArcGISRuntime::Object and Esri::ArcGISRuntime::Loadable |
Public Functions
OfflineMapSyncTask(Esri::ArcGISRuntime::Map *map, QObject *parent = nullptr) | |
virtual | ~OfflineMapSyncTask() override |
QFuture<Esri::ArcGISRuntime::OfflineMapUpdatesInfo *> | checkForUpdatesAsync(QObject *parent = nullptr) |
QFuture<Esri::ArcGISRuntime::OfflineMapSyncParameters> | createDefaultOfflineMapSyncParametersAsync() |
Esri::ArcGISRuntime::Map * | map() const |
Esri::ArcGISRuntime::OfflineMapSyncJob * | syncOfflineMap(const Esri::ArcGISRuntime::OfflineMapSyncParameters ¶meters) |
Esri::ArcGISRuntime::OfflineMapUpdateCapabilities * | updateCapabilities() const |
Reimplemented Public Functions
virtual void | cancelLoad() override |
virtual void | load() override |
virtual Esri::ArcGISRuntime::Error | loadError() const override |
virtual Esri::ArcGISRuntime::LoadStatus | loadStatus() const override |
virtual void | retryLoad() override |
Signals
void | doneLoading(const Esri::ArcGISRuntime::Error &loadError) |
void | loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus) |
Detailed Description
You can take a map offline from a web map using the OfflineMapTask. This can be an offline map created ahead-of-time or an on-demand map. For more information, see the Ahead-of-time vs on-demand workflows. The offline map is stored on the device so its data can be displayed, queried, and edited whilst the device is offline.
You can update the data content by synchronizing the offline map with its source web map. Edits to offline feature data can be posted to the source web map, and any edits to the source web map's feature data content can be downloaded and applied to the offline map. This brings the source web map content and the offline map content into alignment. Edits to features, non-spatial data, related data, and attachments can be synchronized. A network connection must be present for synchronization. Here are typical steps to synchronize data between the offline map and its source web map:
- Create an OfflineMapSyncTask with the offline map (Map).
- Obtain the OfflineMapSyncParameters for the offline map by calling createDefaultOfflineMapSyncParametersAsync. Optionally modify these (for example, to specifying a synchronization direction).
- Create an OfflineMapSyncJob by calling syncOfflineMap(const Esri::ArcGISRuntime::OfflineMapSyncParameters&).
- Start the OfflineMapSyncJob. Upon job completion, examine the OfflineMapSyncResult from the OfflineMapSyncJob::result to determine whether the synchronization was successful.
If there are attribute or geometry level conflicts on a feature during synchronization, the most recently synchronized edit will be applied. For example, if both user A and user B edit the same feature while offline, if user A synchronizes their edits first, then user B synchronizes their edits, the updated feature will represent the edits made by user B.
Synchronization errors typically occur because of network connectivity issues during the sync process. The synchronization mechanism is robust to these types of errors, however, and they can be resolved by synchronizing again when a reliable network connection becomes available.
If you created the offline map using the ahead-of-time workflow, it may support a synchronization workflow known as update packages. Update packages optimize updating the data contents of a downloaded offline map to the latest contents of the source web map. For more information, see Update packages.
If you want to download and synchronize individual feature services to a single offline geodatabase, instead of taking a map offline, then you can use the GeodatabaseSyncTask.
Member Function Documentation
[explicit]
OfflineMapSyncTask::OfflineMapSyncTask (Esri::ArcGISRuntime::Map *map, QObject *parent = nullptr)
Creates an offline map sync task for synchronizing the geodatabases used by a map.
- map - Map to synchronize.
- parent - The optional parent QObject.
[override virtual]
OfflineMapSyncTask::~OfflineMapSyncTask ()
Destructor.
[override virtual]
void OfflineMapSyncTask::cancelLoad ()
Reimplements: Loadable::cancelLoad().
See Loadable.
[since Esri::ArcGISRuntime 200.2]
QFuture<Esri::ArcGISRuntime::OfflineMapUpdatesInfo *> OfflineMapSyncTask::checkForUpdatesAsync (QObject *parent = nullptr)
Retrieves OfflineMapUpdatesInfo for the offline map that was used to construct this task.
- parent - The parent object.
The returned OfflineMapUpdatesInfo provides high level information on what updates are available for this offline map. Information is provided on:
- Online changes that can be applied to update your offline map
- Local changes from your offline map that can be sent back to the online services
Calling this method provides high-level information on the available updates. It can help you to determine whether to call syncOfflineMap(const Esri::ArcGISRuntime::OfflineMapSyncParameters&) immediately, based upon factors such as current disk space and network availability. Examine these properties before starting the potentially time-consuming offline map sync process.
The resulting OfflineMapUpdatesInfo provides a snap-shot of available updates when this method was called. To check for new updates you need to call this method again.
This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.
See Working with QFuture for further details.
This function was introduced in Esri::ArcGISRuntime 200.2.
[since Esri::ArcGISRuntime 200.2]
QFuture<Esri::ArcGISRuntime::OfflineMapSyncParameters > OfflineMapSyncTask::createDefaultOfflineMapSyncParametersAsync ()
Returns a QFuture of OfflineMapSyncParameters for the map that was used to construct this task.
The parameters will be pre-populated with values appropriate for updating the feature data in this offline map.
The default parameters will reflect the mobile geodatabases used by the offline map.
This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.
See Working with QFuture for further details.
This function was introduced in Esri::ArcGISRuntime 200.2.
[signal]
void OfflineMapSyncTask::doneLoading (const Esri::ArcGISRuntime::Error &loadError )
Signal emitted when this object is done loading.
- loadError Details about any error that may have occurred.
Note: If there is a load error it will also be emitted on the errorOccurred signal.
[override virtual]
void OfflineMapSyncTask::load()
Reimplements: Loadable::load().
Loads the metadata for the object asynchronously.
See Loadable.
[override virtual]
Esri::ArcGISRuntime::Error OfflineMapSyncTask::loadError () const
Reimplements: Loadable::loadError() const.
eturns the load error.
See Loadable.
See also Error.
[override virtual]
Esri::ArcGISRuntime::LoadStatus OfflineMapSyncTask::loadStatus () const
Reimplements: Loadable::loadStatus() const.
Returns the load status.
See Loadable.
See also LoadStatus.
[signal]
void OfflineMapSyncTask::loadStatusChanged (Esri::ArcGISRuntime::LoadStatus loadStatus )
Signal emitted when the load status changes for this object.
- loadStatus The LoadStatus.
See also Loadable.
Esri::ArcGISRuntime::Map *OfflineMapSyncTask::map() const
Returns the offline map to synchronize.
[override virtual]
void OfflineMapSyncTask::retryLoad ()
Reimplements: Loadable::retryLoad().
Loads or retries loading metadata for the object asynchronously.
Will retry loading the metadata if the object is failed to load. Will load the object if it is not loaded. Will not retry to load the object if the object is loaded.
See Loadable.
Esri::ArcGISRuntime::OfflineMapSyncJob *OfflineMapSyncTask::syncOfflineMap (const Esri::ArcGISRuntime::OfflineMapSyncParameters ¶meters)
Returns an OfflineMapSyncJob to use to run this OfflineMapSyncTask with the given parameters.
The resulting job will synchronize an offline map's geodatabases with their originating services.
You should not execute more than one sync on a particular geodatabase at the same time. This includes any operations that export or import deltas from the local Geodatabase:
- GeodatabaseSyncTask::exportDeltaAsync(Esri::ArcGISRuntime::Geodatabase*, const QString&)
- GeodatabaseSyncTask::importDeltaAsync(Esri::ArcGISRuntime::Geodatabase*, const QString&, QObject*)
- SyncGeodatabaseJob
- OfflineMapSyncJob.
[since Esri::ArcGISRuntime 100.6]
Esri::ArcGISRuntime::OfflineMapUpdateCapabilities *OfflineMapSyncTask::updateCapabilities () const
Returns the methods that can be used to obtain updates to the offline map.
You can use this property to determine whether an offline map is configured to use the update packages (see OfflineMapUpdateCapabilities::isSupportsScheduledUpdatesForFeatures) or to sync directly with feature services (see OfflineMapUpdateCapabilities::isSupportsSyncWithFeatureServices). If the offline map was created using PreplannedUpdateMode::DownloadScheduledUpdatesAndUploadNewFeatures, it will support both update modes, but you will only be able to upload newly created features.
This property will return nullptr
until the offline map sync task is loaded.
This function was introduced in Esri::ArcGISRuntime 100.6.