@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.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.SyncLoginCodes Codes used bySyncLoginListener.onLoginFailed(long)
. -
Enum Summary Enum Description SyncBuilder.RequestUpdatesMode SyncCredentials.CredentialsType SyncState Returned bySyncClientImpl.getSyncState()
.