Platform Differences

Where Android and iOS behavior is not one-to-one in the KMP SDK.

Beta

The KMP SDK is in beta and its API may change between releases.

The KMP SDK's public API is identical on both platforms: one signature, no platform types, no expect/actual of your own. But it wraps two different native SDKs, and in a handful of places they do not offer the same thing.

This page is the complete list. Everything not mentioned here behaves the same on Android and iOS.

APIs that differ

APIBehavior
SuperwallDelegate.handleSuperwallDeepLinkiOS only. superwall-android has no equivalent delegate hook, so this is never invoked on Android.
Superwall.consume(purchaseToken)Android. Consumes a Play Billing purchase so it can be bought again. On iOS it echoes the token back unchanged.
IntegrationAttribute.FIREBASE_INSTALLATION_IDiOS only. superwall-android has no counterpart; setting it on Android is skipped and logs a warning. Every other IntegrationAttribute works on both.

That is the whole list of behavioral gaps. Notably, customer info is not on it. See below.

Options that only apply to one platform

Setting one of these on the other platform is harmless. It is ignored.

Android only

OptionWhat it does
SuperwallOptions.passIdentifiersToPlayStoreSends the raw appUserId to Play instead of a SHA-256 hash
SuperwallOptions.useMockReviewsEnables mock review functionality
PaywallOptions.preloadDeviceOverridesPer-device-tier overrides for shouldPreload
PaywallOptions.onBackPressedCallback for the hardware back button while a paywall shows

iOS only

OptionWhat it does
SuperwallOptions.shouldBypassAppTransactionCheckSkips the app transaction check on launch
SuperwallOptions.maxConfigRetryCountRetry attempts for fetching configuration (default 6)
PaywallOptions.shouldShowWebRestorationAlertOffers web restoration after a failed restore
PaywallOptions.shouldShowWebPurchaseConfirmationAlertConfirms a successful web checkout purchase

PaywallOptions.transactionBackgroundView works on both platforms, despite its KDoc saying "iOS only". superwall-android has the same option, and the KMP mapper wires it. SPINNER maps to the native spinner and NONE maps to the native null ("show nothing").

Delegate threading

This is the difference most likely to cause problems, because it is a runtime behavior rather than a missing method.

SuperwallDelegate callbacks are not guaranteed to arrive on any particular thread. Which thread a given callback lands on depends on the callback and the platform, and it may change between releases, so do not build on the current behavior.

Treat every delegate callback as if it could arrive on a background thread:

  • Do not touch UI from a callback directly. Hop to the main thread yourself.
  • Keep implementations thread-safe. Do not assume callbacks are serialized against each other.
  • Keep them short. A callback runs before the SDK continues, so blocking in one blocks the SDK, and on whatever thread that happens to be.
class MyDelegate(private val scope: CoroutineScope) : SuperwallDelegate {
    override fun handleSuperwallEvent(eventInfo: SuperwallEventInfo) {
        // Forwarding to an analytics SDK is fine from any thread.
        analytics.track(eventInfo.eventType.name)

        // Anything that touches UI needs to be dispatched to main.
        scope.launch(Dispatchers.Main) { updateMyUi() }
    }
}

Collecting Superwall.subscriptionStatusFlow is usually the easier path when you want subscription changes to drive UI, but it is a plain StateFlow, so it delivers on your collector's context, not on main. Collect it from a main-dispatched scope (collectAsState, viewModelScope, lifecycleScope) and you are safe; collect it on Dispatchers.IO and you are not.

PaywallPresentationHandler closures and the register feature closure are a different story: those are delivered on the main thread on both platforms, deliberately, because they gate UI.

Install differences

The two platforms do not take the same amount of setup. See Install the SDK for the detail.

AndroidiOS
StepsOne Gradle dependencyGradle dependency plus the SuperwallKMPBridge Swift package
Manifest / project editsNone. The library manifest declares the paywall activity and the startup initializerKotlin framework must be exported with isStatic = true
Native SDKsuperwall-android 2.8.0, transitivelySuperwallKit 4.16.1, pinned exactly by the bridge
MinimumminSdk 26iOS 14

In-app paywall previews on Android

The KMP library manifest declares SuperwallPaywallActivity, which is what paywall presentation needs. It does not declare the debug activities that the standalone Android SDK's in-app paywall previews rely on, and neither does superwall-android.

If you need previews on Android, declare them in your own AndroidManifest.xml:

<activity android:name="com.superwall.sdk.debug.DebugViewActivity" />
<activity android:name="com.superwall.sdk.debug.localizations.SWLocalizationActivity" />
<activity android:name="com.superwall.sdk.debug.SWConsoleActivity" />

This path is not yet verified end-to-end on KMP. If you try it, we would like to hear how it goes, so please open an issue.

Getting the right API key

Your Android app and your iOS app are separate apps in the Superwall dashboard, and each one has its own Public API Key. In a KMP project, though, Superwall.configure is usually called once, from shared code. That single call site needs to end up with the Android key when the app runs on Android and the iOS key when it runs on iOS.

One way to do that is Kotlin's expect/actual:

// commonMain
expect val superwallApiKey: String

// androidMain
actual val superwallApiKey: String = "pk_your_android_key"

// iosMain
actual val superwallApiKey: String = "pk_your_ios_key"

// commonMain: one call site, correct key on each platform
Superwall.configure(apiKey = superwallApiKey)

This is the same pattern the sample app uses. Passing the key in from each platform's entry point works just as well; use whatever your project already does for per-platform values.

How is this guide?

On this page