DittoBase

abstract class DittoBase : Closeable

Base class for accessing Ditto-related functionality in the Android and Java SDKs. Use the Ditto class for your platform to create an instance.

Parameters

dependencies

the dependencies required by the SDK to be initialised.

identity

the identity to be used to represent the connected client.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun close()

Shut down Ditto and release all resources. Must be called before recreating a Ditto instance that uses the same persistence directory.

Link copied to clipboard
fun disableSyncWithV3()

Explicitly opt-in to disabling the ability to sync with Ditto peers running any version of the SDK in the v3 (or lower) series of releases.

Link copied to clipboard
protected fun finalize()

Releases native resources before the instance is garbage collected.

Link copied to clipboard
fun getTransportDiagnostics(): DittoTransportDiagnostics

Request bulk status information about the transports. This is mostly intended for statistical or debugging purposes.

Link copied to clipboard
protected abstract fun initSdkVersion()

Initializes the version string in the Ditto core.

Link copied to clipboard
fun observePeers(handler: (List<DittoRemotePeer>) -> Unit): DittoPeersObserver
fun observePeers(callback: DittoPeersObserverV1Callback): DittoPeersObserver

Request information about Ditto peers connected to this device.

Link copied to clipboard
fun observePeersV2(handler: (String) -> Unit): DittoPeersObserver
fun observePeersV2(callback: DittoPeersObserverV2Callback): DittoPeersObserver

Request information about Ditto peers in the local peer-to-peer network. The V2 observer differs from observePeers by providing not just information about the immediate peers, but also multihop information from other peers not immediately connected. V2 presence therefore offers a more complete view of the local peer-to-peer network.

Link copied to clipboard
fun runGarbageCollection()

Removes all sync metadata for any remote peers which aren't currently connected. This method shouldn't usually be called. Manually running garbage collection often will result in slower sync times. Ditto automatically runs a garbage a collection process in the background at optimal times.

Link copied to clipboard
fun setOfflineOnlyLicenseToken(licenseToken: String)

Activate an offline Ditto instance by setting a license token. You cannot sync with Ditto before you have activated it. The offline license token is only valid for manual, offlinePlayground, and sharedKey identities.

Link copied to clipboard
open fun startSync()

Starts the network transports. Ditto will connect to other devices and sync with them where appropriate.

Link copied to clipboard
open fun stopSync()

Stops all network transports.

Link copied to clipboard
protected abstract fun updateTransportSyncWithParameters()

Properties

Link copied to clipboard
var activated: Boolean = false

A flag indicating whether or not the SDK has been activated with a valid license token.

Link copied to clipboard
var appId: String? = null

The App ID component of the identity in use.

Link copied to clipboard
var auth: DittoAuthenticator? = null

Provides access to authentication information and methods for logging on to Ditto Cloud.

Link copied to clipboard
var callback: DittoCallback? = null

An optional callback that will be called with lifecycle events relating to the SDK.

Link copied to clipboard
protected val dependencies: DittoDependencies
Link copied to clipboard
var deviceName: String

Configure a custom identifier for this peer.

Link copied to clipboard
val diskUsage: DiskUsage

Provides access to the SDK's disk usage monitoring.

Link copied to clipboard
protected val dittoWrapper: DittoHandleWrapper

Alias to dittoHandleWrapper with protected visibility for android.Ditto.

Link copied to clipboard
protected val identity: DittoIdentity
Link copied to clipboard
var isSyncActive: Boolean = false

A flag indicating whether or not sync is active. Use startSync() to activate and stopSync() to deactivate sync.

Link copied to clipboard
val persistenceDirectory: String

Path to the persistence directory in use.

Link copied to clipboard
val presence: Presence

3rd version of presence. Use getPresence() to call from Java.

Link copied to clipboard
val sdkVersion: String

Returns a string identifying version metadata of the Ditto SDK. Example: And4.4.3_73d36

Link copied to clipboard
val siteId: BigInteger

The site identifier component of the identity in use.

Link copied to clipboard
val smallPeerInfo: DittoSmallPeerInfo

Provides access to the SDK's small peer info functionality.

Inheritors

Link copied to clipboard