Skip to navigation

Sentinel Android Integration Guide

This guide covers how to add Persona Sentinel SDK to your Android project and how to use the SDK.

Integration

Requirements - Make sure the SDK is compatible

Your application needs to have a minSdkVersion set to API 23 (Android 6.0, Marshmallow) or higher.

Dependencies - Adding Persona to your project

In your app/build.gradle file (or wherever you plan on using the SDK) include the following:

repositories {
// ...
maven {
url = uri("https://sdk.withpersona.com/android/releases")
}
}
android {
// ...
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}
dependencies {
// ...
implementation("com.withpersona.sdk2:sentinel:X.Y.Z")
// ...
}

Required permissions

Our manifest files declare the following permissions.

xml
<uses-permission android:name="android.permission.INTERNET" />

Versioning

If you’re also using the Inquiries Android SDK, ensure both implementations are using the same SDK version.

Usage

The Persona Sentinel SDK collects passive signals from customers via events. The following sections describe how to configure and trigger a Sentinel event.

Triggering a Sentinel Event

The Sentinel object is used to build and trigger an event.

kotlin
Sentinel
.newEventBuilder(
clientToken = CLIENT_TOKEN,
transactionTypeId = TRANSACTION_TYPE_ID,
)
.contextString() // an optional string
.identifiers() // an optional array of strings
.environmentId() // an optional Persona environment ID: defaults to your production environment.
.accountReferenceId("...") // optionally include account reference id for this event
.autoCreateAccount(true) // an optional boolean: defaults to true. Controls whether an account is automatically created.
.autoCreateAccountTypeId("acttp_...") // an optional account type token: defaults to the transaction type's configured default account type.
.build()
.trigger(context)

You may trigger events using trigger(Context) (preferred) or triggerAsync().

trigger(Context) will trigger the event immediately however it is a suspending function. It returns a kotlin.Result object which can be used to determine whether the event was logged successfully.

triggerAsync(context) also requires a Context and will log the event asynchronously without blocking the calling thread.