Overview

FlockSDK-Android enables seamless integration of Flock referral and rewards into your Android applications. Effortlessly build powerful referral programs and track customer engagement in minutes.
  • Identify and track users
  • Trigger checkpoints to show Flock experiences at specific moments in your user journey
  • Officially supported by the Flock team

Requirements

  • Android 6.0 (API 23) or later
  • Kotlin 1.7 or later
  • Android Gradle Plugin 7.0 or later

Installation

  1. Add the SDK to your build.gradle dependencies:
implementation 'com.withflock:flocksdk:YOUR_VERSION'
  1. Replace YOUR_VERSION with the latest version from Jitpack.

Usage

1. Configure the SDK

Call FlockSDK.initialize once, ideally in your Application class or early in your app’s startup:
FlockSDK.initialize(
    publicAccessKey = "<YOUR_FLOCK_PUBLIC_KEY>",
    environment = FlockEnvironment.PRODUCTION // or FlockEnvironment.TEST
)

2. Identify Your User

Identify the current user (after login or at app start):
CoroutineScope(Dispatchers.Main).launch {
    FlockSDK.identify(
        externalUserId = "<USER_ID_IN_YOUR_APP>",
        email = "user@example.com",
        name = "Alice Smith",
        customProperties = mapOf(
            "tier" to "pro",
            "subscription" to "annual"
        )
    )
}

3. Trigger Checkpoints

Trigger checkpoints to show Flock experiences at specific moments in your user journey.

Basic Usage

// Simple checkpoint trigger
FlockSDK.checkpoint("refer_button_clicked").trigger(context)

Checkpoint with Callbacks

FlockSDK.checkpoint("refer_button_clicked")
    .onClose {
        println("Checkpoint closed")
    }
    .onSuccess {
        println("Checkpoint succeeded")
    }
    .onInvalid {
        println("Checkpoint invalid")
    }
    .trigger(context)
Use navigation within success callbacks to show success screens after successful actions:
FlockSDK.checkpoint("user_onboarded")
    .onSuccess {
        // Navigate to success screen when invitee enters valid referral code
        FlockSDK.checkpoint("referral_succeeded").navigate().trigger(context)
    }
    .trigger(context)

Checkpoint Options

The checkpoint system automatically loads campaign checkpoints when you call identify(). Make sure to call identify() before triggering any checkpoints.
Available Methods:
  • navigate(): Navigate within existing web view instead of creating a new placement
  • onClose(): Handle when the checkpoint is closed
  • onSuccess(): Handle successful checkpoint completion
  • onInvalid(): Handle invalid checkpoint events
  • trigger(context): Trigger the checkpoint with configured options (requires Android context)

Why Flock?

  • No UI to build – We handle the referral screens for you.
  • Fully managed backend and analytics.
  • Easy integration and customization.
  • Official support and regular updates.

Support


License

FlockSDK-Android is released under the MIT License.