Webcom Android SDK Public API Reference / com.orange.webcom.sdkv2.datasync / DatasyncService

DatasyncService

class DatasyncService : WebcomAbstractService

The WebcomAbstractService that makes it possible to interact in real time with the data of a Webcom application.

This service mainly provides ways to get/set/update the data and to subscribe to them in order to be notified in real time when they change. Instances of DatasyncService must be built using the WebcomApplication.datasyncService property.

Properties

shouldBeConnected

val shouldBeConnected: Boolean

Indicates whether the DatasyncService tries to establish connection to the Webcom back end.

state

val state: DatasyncState

Synchronously returns the current state of this DatasyncService.

Functions

cleanOfflineCache

fun cleanOfflineCache(): Unit

Stops maintaining updates of data previously watched by cancelled subscriptions within the local cache. In other words, cleans from cache all data that are not currently watched by an active subscription.

connect

fun connect(): Unit

Sets shouldBeConnected to true.

createManager

fun createManager(policy: SubscriptionCancellationPolicy = SubscriptionCancellationPolicy.KeepUpdatingDataWhenImplicit): DatasyncManager

Asks the DatasyncService to create a new DatasyncManager instance. The passed policy controls how the cached data is managed when subscriptions to data events (to be created using the DatasyncNode.subscribe method) are cancelled.

disconnect

fun disconnect(): Unit

Sets shouldBeConnected to false.

isPresent

fun isPresent(value: PresenceState?): Boolean

Indicates whether a value previously set by the startPublishingMyPresence method means that a user is present.

offlineCache

fun offlineCache(): String

Retrieves the content of the current local cache content. It can then be saved somewhere and restored later at next app startup using WebcomConfiguration.offlineCache.

startPublishingMyPresence

fun startPublishingMyPresence(path: String): Unit

Starts maintaining a value at a given path that indicates in real time whether the user of the underlying WebcomApplication is connected and authenticated.

stopPublishingMyPresence

fun stopPublishingMyPresence(): Unit

Stops maintaining the indicator of the user presence, previously started by the startPublishingMyPresence method.