Sync Android SDK  0.8.7
com.twilio.sync.DocumentObserver Class Referenceabstract

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

Public Member Functions

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

Detailed Description

Observer for all operations on a Document.

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

Observer will receive callbacks for all operations on a Document. 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.DocumentObserver.DocumentObserver ( )

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.DocumentObserver.onErrorOccurred ( ErrorInfo  error)

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

Parameters
errorError description.
void com.twilio.sync.DocumentObserver.onOpened ( Document  doc)

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

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

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

Parameters
contextContext indicating if change was local or remote.
void com.twilio.sync.DocumentObserver.onUpdated ( EventContext  context,
JSONObject  data,
JSONObject  prevData 
)

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

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