Ditto

Entrypoint for accessing Ditto-related functionality in the Kotlin SDK.

Constructors

Link copied to clipboard
constructor(dependencies: DittoDependencies, identity: DittoIdentity = OfflinePlayground(dependencies))

Public constructor using legacy dependency injection pattern.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The absolute path to the persistence directory used by this Ditto instance to persist data.

Link copied to clipboard

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

Link copied to clipboard

The App ID component of the identity in use.

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

Returns the configuration used to initialize this Ditto instance.

Link copied to clipboard

Configure a custom identifier for this peer.

Link copied to clipboard

Provides access to the SDK's disk usage monitoring.

Link copied to clipboard

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

Link copied to clipboard

Path to the persistence directory in use.

Link copied to clipboard

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

Link copied to clipboard

A string of version metadata for the Ditto SDK. Example: And4.4.3_73d36

Link copied to clipboard

The site identifier component of the identity in use.

Link copied to clipboard

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

Link copied to clipboard

Provides access to store related functionality.

Link copied to clipboard

Provides access to sync related functionality.

Link copied to clipboard

Assign a new transports configuration. By default peer-to-peer transports (Bluetooth and WiFi) are enabled.

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

Disable sync with peers running version 3 or lower of the Ditto SDK.

Link copied to clipboard

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

Link copied to clipboard

Request information about Ditto peers connected to this device.

Link copied to clipboard

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

Provide a hint to Ditto that app permissions may have changed.

Link copied to clipboard

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

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.

Link copied to clipboard
open fun stopSync()

Stops all network transports.

Link copied to clipboard
Link copied to clipboard
fun updateTransportConfig(configure: (config: DittoTransportConfig) -> Unit)

Convenience method to update the current transport config of the receiver.