Class: Toybox::Communications::SyncDelegate

Inherits:
Lang::Object show all

Overview

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

Since:

  • 3.1.0

Instance Method Summary collapse

Methods inherited from Lang::Object

equals, hashCode, method, toString, weak

Instance Method Details

isSyncNeededToybox::Lang::Boolean

Check if a sync is needed.

Returns:

  • (Toybox::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:

  • 3.1.0


4325
4326
# File 'Monkeybrains.rb', line 4325

def isSyncNeeded()
end

onStartSyncObject

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:

  • 3.1.0


4316
4317
# File 'Monkeybrains.rb', line 4316

def onStartSync()
end

onStopSyncObject

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:

  • 3.1.0


4337
4338
# File 'Monkeybrains.rb', line 4337

def onStopSync()
end