Sync Android SDK  2.0.2
com.twilio.sync.SyncDocumentObserver Class Referenceabstract

Observer for all operations on a SyncDocument. More...

Public Member Functions

 SyncDocumentObserver ()
 Keep default constructor, you don't need to override it. More...
 
void onOpened (SyncDocument doc)
 This callback is invoked when SyncDocument object has been initialised and opened locally. More...
 
void onRemoved (EventContext context, JSONObject previousData)
 This callback is invoked when entire SyncDocument has been removed by a local request. More...
 
void onUpdated (EventContext context, JSONObject data, JSONObject previousData)
 This callback is invoked when a SyncDocument has been modified by a local request. More...
 
void onErrorOccurred (ErrorInfo error)
 This callback is invoked when a SyncDocument operation has encountered an error. More...
 

Detailed Description

Observer for all operations on a SyncDocument.

You should create your own subclass of DocumentObserver and override functions you are interested in.

Observer will receive callbacks for all operations on a SyncDocument. To distinguish parallel streams of local operations your application could use local flow identifier.

Callbacks in the observer will be called from a background thread. You will need to repost your work to UI thread if you do any UI-related operations in the callback.

Constructor & Destructor Documentation

com.twilio.sync.SyncDocumentObserver.SyncDocumentObserver ( )

Keep default constructor, you don't need to override it.

If you do override make sure to call the inherited constructor.

Member Function Documentation

void com.twilio.sync.SyncDocumentObserver.onErrorOccurred ( ErrorInfo  error)

This callback is invoked when a SyncDocument operation has encountered an error.

Parameters
errorError description.
void com.twilio.sync.SyncDocumentObserver.onOpened ( SyncDocument  doc)

This callback is invoked when SyncDocument object has been initialised and opened locally.

Parameters
docSyncDocument object that has been opened. This parameter you should take and use as your initialised instance of a document.
void com.twilio.sync.SyncDocumentObserver.onRemoved ( EventContext  context,
JSONObject  previousData 
)

This callback is invoked when entire SyncDocument has been removed by a local request.

Parameters
contextContext indicating if change was local or remote.
previousDataPrevious contents of the document.
void com.twilio.sync.SyncDocumentObserver.onUpdated ( EventContext  context,
JSONObject  data,
JSONObject  previousData 
)

This callback is invoked when a SyncDocument has been modified by a local request.

Parameters
contextContext indicating if change was local or remote.
dataNew contents of the document.
previousDataPrevious contents of the document.