Ask a Question
Back to All

How to display paywall android

Hi I have been reading the documentation to try and implement a paywall in my android app. I have set up the paywall and followed the sets as best I can however the UI is still not showing.

My current code is

    var product: ProductModel

    Adapty.getPaywalls { paywalls, products, error ->
        if (error == null) {
            // retrieve the products from paywalls
            paywall = paywalls?.firstOrNull { it.developerId == "main" }!!
            product = paywall?.products?.firstOrNull()!!

            Adapty.makePurchase(activity, product) { purchaserInfo, purchaseToken, googleValidationResult, product, error ->
                if (error == null) {
                    // "premium" is an identifier of default access level
                    if (purchaserInfo?.accessLevels!!["premium"]?.isActive == true) {
                        // grant access to premium features

The current implementation loads a blank screen and the the google purchasing flow is automatically triggered.