MySuperWallDocs

Native Android SDK · Kotlin · Gradle

Native Android Paywalls with 0 ms Latency.

Design and configure paywalls remotely in the MySuperWall dashboard. The native Kotlin Android SDK evaluates rules locally on the device and displays dynamic paywalls with zero network wait.

1Add Gradle dependency in your app
2Initialize in your Application class
3Call handleTrigger in your Activity
Google Play Billing Compatible. MySuperWall triggers purchases via product IDs; you execute the purchase flow using Google Play Billing Client or RevenueCat.

Quick start

// 1. Application class
class App : Application() {
    override fun onCreate() {
        super.onCreate()
        MySuperwall.initialize(
            context = this,
            appKey = "YOUR_APP_KEY"
        )
    }
}

// 2. In your Activity
MySuperwall.get().handleTrigger(
    activity = this,
    triggerKey = "onboarding_finish",
    onPurchase = { productId ->
        // Launch Google Play Billing Client purchase
    },
    onRestore = {
        // Handle restore
    },
    onDismiss = {
        // Paywall closed
    }
)

Install the Android SDK

Install com.mysuperwall:sdk:1.4.0 from Maven Central. Add the dependency to your existing app module.

Open guided setup · View on Maven Central

// In settings.gradle.kts, merge with your existing repository configuration:
dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
    }
}

// In app/build.gradle.kts:
dependencies {
    implementation("com.mysuperwall:sdk:1.4.0")
}

// Keep the existing Android/Kotlin plugin versions.
// Requires minSdk 21+ and compileSdk 34+.
// Initialize from your existing Application class.
// The SDK manifest includes INTERNET.

Initialize

import com.mysuperwall.sdk.MySuperwall

MySuperwall.initialize(
    context = this,
    appKey = "YOUR_APP_KEY",
    userId = "optional_user_id" // Auto-generated UUID if omitted
)

Load store prices and prepare the paywall

After initialization, fetch real products from your existing billing provider and build localizedProducts keyed by exact product ID. Values must include displayPrice, priceString and currencyCode; include derived period prices when used. The snippet shows the SDK call, not a complete billing adapter. Wait for successful price and paywall loading before enabling the entry point. Currency follows the store account; it is not converted from device language. Do this once at startup and again only when prices or the language change: new prices or a new locale before every presentation discard the prepared paywall and make each opening slow.

MySuperwall.get().setProductData(localizedProducts) { manifest ->
    // Check manifest != null; enable UI on the main thread.
}

Show a Paywall

MySuperwall.get().handleTrigger(
    activity = this,
    triggerKey = "pro_unlock",
    metadata = mapOf("source" to "home_banner"),
    onPurchase = { productId ->
        Log.d("Paywall", "User wants to buy: $productId")
    },
    onRestore = {
        // Restore flow
    },
    onDismiss = {
        // Dismiss flow
    }
)

User Attributes & Targeting

// Set persistent attributes for audience targeting
MySuperwall.get().setUserAttributes(
    mapOf(
        "tier" to "premium",
        "level" to 10,
        "isSubscriber" to false
    )
)

// Identify user
MySuperwall.get().identify("user_12345")

Push notifications (optional)

Send notifications from the dashboard through your own Firebase project, for example a reminder after someone closes the paywall that opens a discount paywall. The SDK has no Firebase dependency: your app reads the FCM token and hands it over.

Requires Android SDK 1.5.0 or later.

  1. Connect Firebase. In the dashboard open Integrations → Push notifications and upload a Firebase service account key (role: Firebase Cloud Messaging Admin).
  2. Register the device. After the user allows notifications, pass the FCM token to the SDK, and again whenever it refreshes. It is registered for the current user and language, and again by itself when you change either.
  3. Handle taps. Give the notification data to the SDK when the user taps it. It reports the tap and returns the trigger to open, so a discount trigger shows your offer.
  4. Create a notification. In the dashboard open Notifications, choose when to send (for example after the paywall was closed), write the text per language and pick the trigger each reminder opens.
// Token: after the user allowed notifications (POST_NOTIFICATIONS on Android 13+)
FirebaseMessaging.getInstance().token.addOnSuccessListener { token ->
    MySuperwall.get().setPushToken(token)
}
class AppMessagingService : FirebaseMessagingService() {
    override fun onNewToken(token: String) {   // called when the token refreshes
        MySuperwall.get().setPushToken(token)
    }
}

// Launcher activity: the user tapped a notification (onCreate and onNewIntent)
MySuperwall.get().handleNotificationOpened(this, intent.extras)

// Stop notifications (logout, or the user turned them off):
MySuperwall.get().clearPushToken()

Each device gets the text for its language (the SDK locale); devices without a matching language get the default one. Someone who just bought is skipped, and a purchase cancels pending notifications. Translating the text with DeepL is a Premium feature.

Android shows FCM notifications only while the app is in the background. Keep the WAKE_LOCK permission in your manifest (Firebase needs it) and request POST_NOTIFICATIONS on Android 13+.

0 ms Offline Cache & Local Rule Engine

The Android SDK stores the active paywalls manifest in SharedPreferences. At trigger time, the in-memory LocalRuleEngine evaluates A/B test variants, semantic app versions, and audience rules directly in memory with zero network latency.

API Reference

MethodDescription
MySuperwall.initialize(...)Initializes SDK, loads disk manifest into RAM, starts background sync.
MySuperwall.get().handleTrigger(...)Evaluates rules in memory and presents PaywallDialogFragment.
MySuperwall.get().resolveTrigger(...)Resolves PaywallResult without displaying UI.
MySuperwall.get().identify(...)Sets authenticated user ID.
MySuperwall.get().setUserAttributes(...)Sets custom metadata for audience targeting.
setPushToken(token)Register the FCM token for this device
clearPushToken()Stop notifications for this device
trackNotificationOpened(extras)Report a notification tap and get the trigger to open
handleNotificationOpened(activity, extras, ...)Report the tap and show the notification's paywall

MySuperWall Android Kotlin SDK · © 2026