|
Sync Android SDK
0.9.0
|
This is a central entity used to work with Sync. More...
Classes | |
| enum | ConnectionState |
| Enum representing underlying twilsock connection state. More... | |
| interface | ConnectionStateListener |
| Listener interface to receive connection state change events. More... | |
| class | LogLevel |
| Log level constants for passing to setLogLevel. More... | |
| class | Properties |
| Specify properties for creating new Sync Client. More... | |
Public Member Functions | |
| native void | updateToken (String accessToken, SuccessListener< Void > listener) |
| Update SyncClient with a refreshed token. More... | |
| void | shutdown () |
| Cleanly shut down the SyncClient and free up associated resources. More... | |
| void | openDocument (Options options, DocumentObserver observer, SuccessListener< Document > output) |
| Open or create a Document object. More... | |
| void | openList (Options options, ListObserver observer, SuccessListener< List > output) |
| Open or create a List object. More... | |
| void | openMap (Options options, MapObserver observer, SuccessListener< Map > output) |
| Open or create a Map object. More... | |
| void | openStream (Options options, StreamObserver observer, SuccessListener< Stream > output) |
| Open or create a Stream object. More... | |
| native ConnectionState | getConnectionState () |
| void | setConnectionStateListener (ConnectionStateListener userListener) |
| Set new connection state listener on the client. More... | |
Static Public Member Functions | |
| static void | create (@NonNull Context context, String accessToken, Properties props, SuccessListener< SyncClient > listener) |
| Public factory method to create a new instance of Sync Client. More... | |
| static String | getSdkVersion () |
| static void | setLogLevel (int level) |
| Set verbosity level for log messages to be printed to android logcat. More... | |
This is a central entity used to work with Sync.
After creating a SyncClient you can open, create and modify Documents, Lists and Maps.
todo: more detailed description with code examples please.
|
static |
Public factory method to create a new instance of Sync Client.
| 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() |
| listener | Listener to receive the newly created Sync Client. |
| native ConnectionState com.twilio.sync.SyncClient.getConnectionState | ( | ) |
|
static |
| void com.twilio.sync.SyncClient.openDocument | ( | Options | options, |
| DocumentObserver | observer, | ||
| SuccessListener< Document > | output | ||
| ) |
Open or create a Document object.
| options | Options that specify open mode and possible SID or Unique Name of the Document. |
| 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 com.twilio.sync.SyncClient.openList | ( | Options | options, |
| ListObserver | observer, | ||
| SuccessListener< List > | output | ||
| ) |
Open or create a List object.
| options | Options that specify open mode and possible SID or Unique Name of the List. |
| 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 com.twilio.sync.SyncClient.openMap | ( | Options | options, |
| MapObserver | observer, | ||
| SuccessListener< Map > | output | ||
| ) |
Open or create a Map object.
| options | Options that specify open mode and possible SID or Unique Name of the Map. |
| 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 com.twilio.sync.SyncClient.openStream | ( | Options | options, |
| StreamObserver | observer, | ||
| SuccessListener< Stream > | output | ||
| ) |
Open or create a Stream object.
| options | Options that specify open mode and possible SID or Unique Name of the Stream. |
| 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. |
| void com.twilio.sync.SyncClient.setConnectionStateListener | ( | ConnectionStateListener | userListener | ) |
Set new connection state listener on the client.
Set to null to clear. As soon as listener is set it will receive onConnectionStateChanged callback with the current state of the connection.
| userListener | New listener to use or null to remove listener. |
|
static |
Set verbosity level for log messages to be printed to android logcat.
Default log level is LogLevel#SILENT.
| level | Verbosity level. See LogLevel for supported options. |
| void com.twilio.sync.SyncClient.shutdown | ( | ) |
Cleanly shut down the SyncClient and free up associated resources.
Call this when exiting application or when done working with the SyncClient to properly finish working with Sync.
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.
| native void com.twilio.sync.SyncClient.updateToken | ( | String | accessToken, |
| SuccessListener< Void > | listener | ||
| ) |
Update SyncClient with a refreshed token.
| accessToken | New access token containing at least a Sync Grant to access sync features. |
| listener | Listener to receive status of the operation. |