public interface SyncClient
SyncDocuments,
SyncLists, SyncMaps and SyncStreams.
todo: more detailed description with code examples please.
| Modifier and Type | Interface and Description |
|---|---|
static class |
SyncClient.ConnectionState
Enum representing underlying twilsock connection state.
|
static class |
SyncClient.LogLevel
Log level constants for passing to
setLogLevel(int). |
static interface |
SyncClient.Properties
Specify properties for creating new Sync Client.
|
static interface |
SyncClient.SyncClientListener
This interface defines SyncClient callback methods.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
create(android.content.Context context,
java.lang.String accessToken,
SyncClient.Properties props,
SuccessListener<SyncClient> listener)
Public factory method to create a new instance of Sync Client.
|
SyncClient.ConnectionState |
getConnectionState() |
static java.lang.String |
getSdkVersion() |
void |
openDocument(SyncOptions options,
SyncDocumentObserver observer,
SuccessListener<SyncDocument> output)
Open or create a
SyncDocument object. |
void |
openList(SyncOptions options,
SyncListObserver observer,
SuccessListener<SyncList> output)
Open or create a
SyncList object. |
void |
openMap(SyncOptions options,
SyncMapObserver observer,
SuccessListener<SyncMap> output)
Open or create a
SyncMap object. |
void |
openStream(SyncOptions options,
SyncStreamObserver observer,
SuccessListener<SyncStream> output)
Open or create a
SyncStream object. |
void |
setListener(SyncClient.SyncClientListener listener)
Set new listener on the client.
|
static void |
setLogLevel(int level)
Set verbosity level for log messages to be printed to android logcat.
|
void |
shutdown()
Cleanly shut down the SyncClient and free up associated resources.
|
void |
updateToken(java.lang.String accessToken,
SuccessListener<java.lang.Void> listener)
Update SyncClient with a refreshed token.
|
static void create(android.content.Context context,
java.lang.String accessToken,
SyncClient.Properties props,
SuccessListener<SyncClient> listener)
context - Pass Application Context here, cannot be null.accessToken - Access token containing at least a Sync Grant to access sync features.props - Properties for initializing client. Properties.defaultProperties()
could be commonly used. See SyncClient.Properties for more details.listener - Listener to receive the newly created Sync Client.static java.lang.String getSdkVersion()
void updateToken(java.lang.String accessToken,
SuccessListener<java.lang.Void> listener)
accessToken - New access token containing at least a Sync Grant to access sync features.listener - Listener to receive status of the operation.void shutdown()
Avoid calling methods on Sync objects from their own callback events, as it may lead to unexpected nesting and poorly predictable behavior. SyncClient shutdown method must not be called from an event callback.
It will dispose() the client after shutdown, so it could not be reused.
void openDocument(SyncOptions options, SyncDocumentObserver observer, SuccessListener<SyncDocument> output)
SyncDocument object.options - SyncOptions that specify open mode and possible SID or Unique Name of the SyncDocument.observer - Observer to receive callbacks on all actions performed on the document both
locally and remotely.output - Listener that will receive opened document in its onSuccess() callback or
any error in onError() callback.void openList(SyncOptions options, SyncListObserver observer, SuccessListener<SyncList> output)
SyncList object.options - SyncOptions that specify open mode and possible SID or Unique Name of the SyncList.observer - Observer to receive callbacks on all actions performed on the list both
locally and remotely.output - Listener that will receive opened list in its onSuccess() callback or
any error in onError() callback.void openMap(SyncOptions options, SyncMapObserver observer, SuccessListener<SyncMap> output)
SyncMap object.options - SyncOptions that specify open mode and possible SID or Unique Name of the SyncMap.observer - Observer to receive callbacks on all actions performed on the map both
locally and remotely.output - Listener that will receive opened map in its onSuccess() callback or
any error in onError() callback.void openStream(SyncOptions options, SyncStreamObserver observer, SuccessListener<SyncStream> output)
SyncStream object.options - SyncOptions that specify open mode and possible SID or Unique Name of the SyncStream.observer - Observer to receive callbacks on all actions performed on the stream both
locally and remotely.output - Listener that will receive opened stream in its onSuccess() callback or
any error in onError() callback.SyncClient.ConnectionState getConnectionState()
void setListener(SyncClient.SyncClientListener listener)
onConnectionStateChanged callback
with the current state of the connection.listener - New listener to use or null to remove listener.static void setLogLevel(int level)
SyncClient.LogLevel.SILENT.level - Verbosity level. See SyncClient.LogLevel for supported options.