dittosynckit / live.ditto / DittoSyncKit

DittoSyncKit

class DittoSyncKit

DittoSyncKit is the entry point for accessing Ditto-related functionality.

Parameters

dependencies - the dependencies required by the SDK to be initialised.

identity - the identity to be used to represent the connected client.

Constructors

<init>

Creates a DittoSyncKit instance.

DittoSyncKit(dependencies: DittoSyncKitDependencies, identity: DittoIdentity = DittoIdentity.Development())

Properties

activated

flag indicating whether or not the SDK has been activated with an access license.

var activated: Boolean

callback

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

var callback: DittoSyncKitCallback?

sdkVersion

Returns a string identifying the version of the DittoSyncKit SDK.

val sdkVersion: String

siteID

the site ID component of the identity in use.

val siteID: Long

store

provides access to the SDK's store functionality.

val store: DittoStore

Functions

clearSiteID

Clears the cached site ID, if one had been cached.

fun clearSiteID(): Unit

finalize

fun finalize(): Unit

getTransportDiagnostics

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

fun getTransportDiagnostics(): TransportDiagnostics

observePeers

Request information about Ditto peers in range of this device.

fun observePeers(handler: (List<RemotePeer>) -> Unit): PeersObserver

refreshPermissions

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

fun refreshPermissions(): Unit

setAccessLicense

Activate a DittoSyncKit instance by setting an access license. You cannot interact with DittoSyncKit before you have activated it.

fun setAccessLicense(license: String): Unit

start

Start a set of transports being used by DittoSyncKit to connect to other devices. This has no effect if a provided transport is already started.

fun start(transports: Set<DittoTransports> = mutableSetOf( DittoTransports.WiFi, DittoTransports.Bluetooth )): Unit

stop

Stop all transports

fun stop(): Unit

Stop a set of transports from being used by DittoSyncKit to connect to other devices.

fun stop(transports: Set<DittoTransports>): Unit

Companion Object Properties

deviceName

Configure a custom identifier for the current device.

var deviceName: String

logger

The logger that will be used to log all Ditto-related logs. A default one is set that logs to logcat.

var logger: DittoLogger

loggingEnabled

Represents whether logging is enabled.

var loggingEnabled: Boolean

minimumLogLevel

The minimum log level at which logs will be logged, provided loggingEnabled is true.

var minimumLogLevel: LogLevel