TrustSignalsSDK

Public entry point for the Trust Signals SDK.

Usage:

TrustSignalsSDK.initialize(context, TSConfiguration(collectionUrl = "…"))

// Coroutine
val collection = TrustSignalsSDK.collect()
val credentials = TSCredentials(
accountId = "…",
accessToken = "…",
serviceId = "…", // UUID
unitId = "futapp-android",
interactionId = "…", // UUID or <UUID>-<sessionId>
verificationStatus = TSVerificationStatus.VERIFIED,
)
val uploaded = TrustSignalsSDK.collectAndUpload(credentials)

// Coroutine — override the configured timeout for this call only
val collectionWithTimeoutOverriden = TrustSignalsSDK.collect(timeoutMs = 5_000L)

// Coroutine — multiple accounts: collect once, upload in parallel
val uploaded = TrustSignalsSDK.collectAndUpload(
credentialsForAccount1,
credentialsForAccount2,
)

// Callback
TrustSignalsSDK.collect(onSuccess = { … }, onError = { … })
TrustSignalsSDK.collectAndUpload(credentials, onSuccess = { … }, onError = { … })

// Scheduled (WorkManager — minimum collectionInterval enforced by the OS is 15 minutes)
TrustSignalsSDK.scheduleCollections(
collectionInterval = 15.minutes,
credentialsForAccount1,
credentialsForAccount2,
)
TrustSignalsSDK.stopScheduledCollections()

Properties

Link copied to clipboard

Minimum collectionInterval accepted by scheduleCollections.

Link copied to clipboard
const val version: String

SDK version string.

Functions

Link copied to clipboard
suspend fun collect(timeoutMs: Long? = null): TSCollection
fun collect(timeoutMs: Long? = null, onSuccess: (TSCollection) -> Unit, onError: (Exception) -> Unit)
Link copied to clipboard
suspend fun collectAndUpload(vararg credentials: TSCredentials, timeoutMs: Long? = null): TSCollection

Collects signals once and uploads the result to the server for each provided credentials in parallel. Signals are only collected once regardless of how many credentials are supplied.

fun collectAndUpload(vararg credentials: TSCredentials, timeoutMs: Long? = null, onSuccess: (TSCollection) -> Unit, onError: (Exception) -> Unit)
Link copied to clipboard
fun initialize(context: Context, configuration: TSConfiguration)
Link copied to clipboard
fun registerErrorHandler(handler: (accountId: String, Exception) -> Unit)

Registers a handler that receives errors from scheduled collect-and-upload workers.

Link copied to clipboard
fun scheduleCollections(collectionInterval: Duration, vararg credentials: TSCredentials)

Enqueues (or replaces) one independent recurring WorkManager job per credentials entry. Each job collects and uploads signals on its own and can be cancelled individually via stopScheduledCollections. Calling again with the same account ID replaces that account's existing schedule.

Link copied to clipboard

Cancels all active scheduled collect-and-upload jobs across every account. Safe to call even if no jobs are running.

fun stopScheduledCollections(vararg accountIds: String)

Cancels the scheduled collect-and-upload job for each of the given accountIds. Safe to call even if no job is running for any of the accounts.