Skip to main content

Hello,

I’m trying to use custom display logic in my android’s paywall dialog.

I use “setShouldDisplayBlock” according to the documentation, however it seems it’s being ignored.

Let’s use an exaggerated example:

val paywallDialogOptions = PaywallDialogOptions.Builder()    .setShouldDisplayBlock {        false    }   .setRequiredEntitlementIdentifier(PurchaseManager.premiumEntitlementId)    .build()PaywallDialog(paywallDialogOptions = paywallDialogOptions)

It should never be displayed according to the documentation, yet it’s being shown the moment the screen is open.

Did I get something wrong?

I created a simple project that it can be tested on - https://github.com/kmalyshev/purchases-paywall-problem. You’d need to add a revenuecat’s api key and the entitlement identifier

Hi @simplesoft,

I am curious why you are calling setShouldDisplayBlock with setRequiredEntitlementIdentifier. Usually setShouldDisplayBlock is used when you have custom logic but setRequiredEntitlementIdentifier will display the paywall automatically if the entitlement is not active. It sounds like you should remove one of them to achieve the desired behavior? Remove setShouldDisplayBlock if you want the paywall to be displayed automatically or remove setRequiredEntitlementIdentifier if you want to display the paywall manually.


Hi Sharif,

Thank you for the comment, it resolved my issue, now it works as planned. I wasn’t aware that setRequiredEntitlementIdentifier overrides the logic, I misread the documentation for this line.

Thanks!