Android

A Kotlin library with a Jetpack Compose support screen. minSdk 24, compileSdk 35.

Install#

app/build.gradle.kts
dependencies {
    implementation("app.parleyai:parley-android:0.1.0")
}

The artifact is published to Maven Central. Until a release is published, include the module from source: copy sdks/android into your project and add include(":parley-android", ":parley-core") to settings.gradle.kts.

Initialize#

class MyApp : Application() {
    override fun onCreate() {
        super.onCreate()
        Parley.initialize(this, appKey = "pk_live_…")
    }
}

Show support#

Parley.presentSupport(context)

Identify users#

Parley.identify(
    userId = user.id,
    email = user.email,
    name = user.name,
    userHash = session.parleyUserHash,
    attributes = mapOf("plan" to "pro", "seats" to 6),
) { result -> result.onFailure { Log.w("Parley", "identify failed", it) } }

// From a coroutine
lifecycleScope.launch { Parley.awaitIdentify(userId = user.id, userHash = session.parleyUserHash) }

// On sign-out
Parley.logout()
NameTypeDescription
Parley.initialize(context, appKey, options)funCall once in Application.onCreate().
Parley.identify(...)funFire-and-forget with an optional callback.
Parley.awaitIdentify(...)suspend funCoroutine version of identify.
Parley.updateCustomer(email, name, attributes)funUpdate details.
Parley.track(name, properties)funRecord an event.
Parley.logout()funEnd the session.
Parley.presentSupport(context)funOpens ParleySupportActivity.
ParleySupportScreen(onClose)@ComposableEmbed in your own UI.
Parley.unreadCountStateFlow<Int>Unread replies, for badges.

See Appearance and Push notifications.