ditto / live.ditto / Ditto

Ditto

class Ditto

Ditto 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 Ditto instance.

Ditto(dependencies: DittoDependencies, 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: DittoCallback?

sdkVersion

Returns a string identifying the version of the Ditto SDK.

val sdkVersion: String

siteID

the site ID component of the identity in use.

val siteID: BigInteger

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

connectToWiFiP2PLeader

fun connectToWiFiP2PLeader(deviceName: String): Unit

finalize

fun finalize(): Unit

generateRandomSiteId

fun generateRandomSiteId(): BigInteger

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<DittoRemotePeer>) -> Unit): DittoPeersObserver
fun observePeers(callback: DittoPeersObserverCallback): DittoPeersObserver

refreshPermissions

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

fun refreshPermissions(): Unit

setAccessLicense

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

fun setAccessLicense(license: String): Unit

start

Start a set of transports being used by Ditto 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 Ditto 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