Class: Toybox.Communications.SyncDelegate
- Inherits:
-
Toybox.Lang.Object
Overview
A delegate object that the user implements to respond to sync requests from the system.
Instance Method Summary collapse
-
isSyncNeeded() as Lang.Boolean
Check if a sync is needed.
-
onStartSync() as Void
Called when a sync is started by the system.
-
onStopSync() as Void
Called when an active sync is cancelled.
Instance Method Details
isSyncNeeded() as Lang.Boolean
Check if a sync is needed.
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.
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().