InAppify

Install and start with Kotlin Android

Install Kotlin SDK 0.2.1 through Gradle/JitPack and prepare a shared client, coroutines and store purchase Activity.

This SDK targets Android with Kotlin, not Kotlin Multiplatform or iOS. Flutter applications should install the Flutter package.

Dependency repository

Merge into the existing settings.gradle.kts, preserving repositories used by other libraries:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        exclusiveContent {
            forRepository {
                maven {
                    name = "InappifyJitPack"
                    url = uri("https://jitpack.io")
                }
            }
            filter {
                includeGroup("com.github.InappifyLabs")
                includeGroup("com.github.cafebazaar.Poolakey")
            }
        }
    }
}

Application dependency

In app/build.gradle.kts:

dependencies {
    implementation("com.github.InappifyLabs:kotlin-sdk:v0.2.1")
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
}

Keep the full v0.2.1 tag. Align coroutines with other host dependencies. The library builds with JDK 17, Gradle 8.7, AGP 8.5.1, Kotlin 1.9.0 and compileSdk 34; minSdk is 21. The host can require a higher minimum. Library JVM bytecode targets 1.8.

Shared client

import android.content.Context
import com.inappify.sdk.InappifyClient
import com.inappify.sdk.InappifyV2Client

class BillingOwner(context: Context) : AutoCloseable {
    val client: InappifyV2Client = InappifyClient.create(context.applicationContext)
    override fun close() = client.close()
}

BillingOwner is a host example class. Keep one owner in application/DI scope. Client creation makes no network request; configure starts the session. Call close() only when that owner permanently ends, not when a purchase screen closes. Closing is not logout.

Configure from a coroutine

Call suspend APIs from an appropriate host coroutine, for example the startup service or viewModelScope.launch. Do not block the UI thread with runBlocking:

import com.inappify.sdk.*

suspend fun configureMobile(
    client: InappifyV2Client,
    apiKey: String,
    customerId: String? = null,
): InappifyResult<Unit> = client.configure(
    InappifyOptions(apiKey = apiKey, appUserIdentifier = customerId)
)

Only apiKey is required; the example's customerId maps to optional appUserIdentifier. Configuration covers guest and authenticated startup.

Activity and store setup

A new Bazaar/Myket purchase needs the current Activity implementing ActivityResultRegistryOwner and LifecycleOwner, such as ComponentActivity or FragmentActivity. Do not retain an Activity globally. Store adapters/manifests are included; no parallel helper/AIDL is needed.

Products and app signing must match the store setup. Install and sign in to the store on the device. Bazaar subscriptions are supported; Myket subscriptions are not. The server session supplies route/RSA, not configure arguments.

Offerings · Package purchase · Cache and recovery · Released source