@ParametersAreNonnullByDefault
Package io.objectbox.sync
ObjectBox Sync allows to automatically synchronize local data with a sync
destination (e.g. a sync server) and vice versa. This is the sync client package.
These are the typical steps to setup a sync client:
- Create a BoxStore as usual (using MyObjectBox).
- Get a
SyncBuilder
usingSync.client(boxStore, url, credentials)
. Here you need to pass theBoxStore
, along with an URL to the sync destination (server), and credentials. For demo set ups, you could start withSyncCredentials.none()
credentials. - Optional: use the
SyncBuilder
instance from the last step to configure the sync client and set initial listeners. - Call
SyncBuilder.build()
to get an instance ofSyncClient
(and hold on to it). Synchronization is now active. - Optional: Interact with
SyncClient
.
-
Interface Summary Interface Description ObjectsMessageBuilder SyncClient ObjectBox sync client. -
Class Summary Class Description ConnectivityMonitor Used bySyncClient
to observe connectivity changes.Credentials Credentials consist of a type and the credentials data to perform authentication checks.Credentials.Vector CredentialsType Credentials types for login at a sync server.Sync ObjectBox Sync makes data available on other devices.SyncBuilder A builder to create aSyncClient
; the builder itself should be created viaSync.client(BoxStore, String, SyncCredentials)
.SyncChange A collection of changes made to one entity type during a sync transaction.SyncClientImpl Internal sync client implementation.SyncClientImpl.ObjectsMessageBuilderImpl SyncCredentials Use the static helper methods to build Sync credentials, for exampleSyncCredentials.sharedSecret("secret")
.SyncCredentialsToken Internal credentials implementation.SyncCredentialsUserPassword Internal credentials implementation for user and password authentication.SyncFlags Flags to adjust sync behavior like additional logging.SyncHybrid Combines the functionality of a Sync client and a Sync server.SyncHybridBuilder Builder for a Sync client and server hybrid setup, aSyncHybrid
.SyncLoginCodes Codes used bySyncLoginListener.onLoginFailed(long)
. -
Enum Summary Enum Description SyncBuilder.RequestUpdatesMode SyncCredentials.CredentialsType SyncState Returned bySyncClientImpl.getSyncState()
.