Android Guide

Install

The Android SDK is hosted on Maven Central.

First, be sure you have Maven Central in your project-level build.gradle or settings.gradle file

// settings.gradle.kts
dependencyResolutionManagement {
    repositories {
        mavenCentral()
    }
}

Then include the dependency in your module-level build.gradle file

// build.gradle.kts
dependencies {
    implementation("ai.resubscribe:resubscribe-android-sdk:1.0.10")
}

Now perform a Gradle sync to download the library.

Usage

When you would like to open up Resubscribe, call openWithConsent, replacing the placeholder values with your own values.

Resubscribe.openWithConsent(this@SomeActivity, ResubscribeOptions(
    slug = "{organization-slug}",
    apiKey = "{api-key}",
    aiType = AIType.{Intent | Churn},
    userId = "{uid}",
    userEmail = "{optionalEmail}",
))

The value of userId MUST be unique. If you do not have a unique user id at the point you want to make this call, we recommend generating a random value prefixed with 'anonymous-' for every user

Configuration

You can pass the following parameters into openWithConsent.

Param nameDescriptionDefault Value

aiType

This value affects how the AI interacts with the user. Options are AIType.Intent and AIType.Churn. They are described in the Overview page.

AIType.Churn

apiKey

The secret for authenticating with Resubscribe

Required

cancelButtonText

The text shown to the user on the button for declining to chat

'Not right now'

description

The smaller text shown in the consent dialog before the user chats with our bot

Varies by aiType

onClose

A function which gets called when the user exits the experience, with a parameter of 'cancel-consent' if the user pressed the cancel button in the dialog or 'close' if they pressed the close button in the chat interface

primaryButtonText

The text shown to the user on the button for consenting to chat

'Let's chat!'

slug

The short string identifying your organization

Required

title

The large text titling the consent dialog shown before the user chats with our bot

Varies by aiType

userEmail

A contact email for the user that gets plumbed through to all reports.

userId

A unique identifier for the user in question.

Required

Last updated