Superwall

configure()

A static function that configures a shared instance of Superwall for use throughout your app.

This is a static method called on the Superwall class itself, not on the shared instance. The Android SDK requires an Application context for initialization.

Purpose

Configures the shared instance of Superwall with your API key and optional configurations, making it ready for use throughout your Android app.

public fun configure(
    applicationContext: Application,
    apiKey: String,
    purchaseController: PurchaseController? = null,
    options: SuperwallOptions? = null,
    activityProvider: ActivityProvider? = null,
    completion: ((Result<Unit>) -> Unit)? = null
)

Parameters

Prop

Type

Returns / State

Configures the Superwall instance which is accessible via Superwall.instance.

class MyApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        Superwall.configure(
            applicationContext = this,
            apiKey = "pk_your_api_key"
        )
    }
}

With custom options:

class MyApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        
        val options = SuperwallOptions().apply {
            paywalls.shouldShowPurchaseFailureAlert = false
        }
        
        Superwall.configure(
            applicationContext = this,
            apiKey = "pk_your_api_key",
            options = options
        ) {
            println("Superwall configured successfully")
        }
    }
}

How is this guide?

Edit on GitHub