I am implementing Paywalls on kotlin for my Android app, however whenever the user swipes back or presses the back button, the paywall simply goes away and a white screen shows up. For context, I am implementing a hard paywall (without a back button, or option to say no). I wonder how I can override this behavior. I am using version 7.4.0.
Page 1 / 1
Hi
If you’re using paywalls through compose, you could handle displaying the paywall yourself by adding the appropriate logic in the listeners, like:
var shouldShowPaywall by remember {
mutableStateOf(true)
}
if (shouldShowPaywall) {
Paywall(
PaywallOptions.Builder({ /* Leave empty */ })
.setListener(object : PaywallListener {
override fun onPurchaseCompleted(
customerInfo: CustomerInfo,
storeTransaction: StoreTransaction
) {
if (customerInfo.entitlements.active.containsKey("MY_ENTITLEMENT_ID")) {
shouldShowPaywall = false
}
}
override fun onRestoreCompleted(customerInfo: CustomerInfo) {
if (customerInfo.entitlements.active.containsKey("MY_ENTITLEMENT_ID")) {
shouldShowPaywall = false
}
}
})
.build(),
)
}
If you’re using the `PaywallActivityLauncher` to display the paywall as an activity, we currently don’t support disabling the back button, but we’re considering adding that as a feature request.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.