launchIfNeeded

fun launchIfNeeded(requiredEntitlementIdentifier: String, offering: Offering? = null, fontProvider: ParcelizableFontProvider? = null, shouldDisplayDismissButton: Boolean = DEFAULT_DISPLAY_DISMISS_BUTTON, edgeToEdge: Boolean = defaultEdgeToEdge, paywallDisplayCallback: PaywallDisplayCallback? = null)

Launch the paywall activity if the current user does not have requiredEntitlementIdentifier active.

Parameters

offering

The offering to be shown in the paywall. If null, the current offering will be shown.

fontProvider

The ParcelizableFontProvider to be used in the paywall. If null, the default fonts will be used. Only available for original template paywalls. Ignored for v2 Paywalls.

requiredEntitlementIdentifier

the paywall will be displayed only if the current user does not have this entitlement active.

shouldDisplayDismissButton

Whether to display the dismiss button in the paywall. Only available for original template paywalls. Ignored for v2 Paywalls.

edgeToEdge

Whether to display the paywall in edge-to-edge mode. On versions below Android 15, edge-to-edge is enabled only if this is set to true. On Android 15 (API 35), edge-to-edge is enabled by default, so this parameter has no effect unless the app has opted out via the manifest. On Android 16+ (API 36), edge-to-edge is enforced by the system and cannot be disabled.

paywallDisplayCallback

Callback that will be called with true if the paywall was displayed


fun launchIfNeeded(offering: Offering? = null, fontProvider: ParcelizableFontProvider? = null, shouldDisplayDismissButton: Boolean = DEFAULT_DISPLAY_DISMISS_BUTTON, edgeToEdge: Boolean = defaultEdgeToEdge, shouldDisplayBlock: (CustomerInfo) -> Boolean)

Launch the paywall activity based on whether the result of shouldDisplayBlock is true.

Parameters

offering

The offering to be shown in the paywall. If null, the current offering will be shown.

fontProvider

The ParcelizableFontProvider to be used in the paywall. If null, the default fonts will be used. Only available for original template paywalls. Ignored for v2 Paywalls.

shouldDisplayDismissButton

Whether to display the dismiss button in the paywall. Only available for original template paywalls. Ignored for v2 Paywalls.

edgeToEdge

Whether to display the paywall in edge-to-edge mode. On versions below Android 15, edge-to-edge is enabled only if this is set to true. On Android 15 (API 35), edge-to-edge is enabled by default, so this parameter has no effect unless the app has opted out via the manifest. On Android 16+ (API 36), edge-to-edge is enforced by the system and cannot be disabled.

shouldDisplayBlock

the paywall will be displayed only if this returns true.