Class: Toybox.Communications.SyncDelegate

Overview

A delegate object that the user implements to respond to sync requests from the system.

Since:

API Level 3.1.0

Supported Devices:

Instance Method Summary collapse

Instance Method Details

isSyncNeeded() as Lang.Boolean

Check if a sync is needed.

Returns:

  • Lang.Boolean
    • When true, a sync is needed

    • When false a sync is not needed and onStartSync will not be called if a sync is triggered for this application

Since:

API Level 3.1.0

onStartSync() as Void

Called when a sync is started by the system.

This method should be used to kick-off the application sync process. This includes any setup required to fetch the data needed to prepare the sync, as well as the initial call to makeWebRequest() to download the first piece of content. Note that, when using this method, you must chain your makeWebRequest() calls together manually. Additionally, you must call notifySyncProgress() intermittently to enable sync progress updates to be displayed in the native user interface for the device. Finally, notifySyncComplete() must be called either when the sync has successfully completed, or if an error occurs, so that the device can be properly notified that the sync process is finished.

Since:

API Level 3.1.0

onStopSync() as Void

Called when an active sync is cancelled.

This method will be called when an active sync is being cancelled by the user. The app is responsible for calling the cancelAllRequests() to cancel any requests made for a sync process. The app is also responsible to let the system know that sync has successfully been cancelled by calling notifySyncComplete().

Since:

API Level 3.1.0


Generated Dec 11, 2024, 8:58:43 AM