Display flows & paywalls - Unity

Display flows and paywalls
Flows Built in Flow builder — renders natively on device, no WebView
Paywall Builder paywalls All existing Paywall Builder content

If you’ve created a flow or paywall, you don’t need to worry about rendering it in your mobile app code to display it to the user. Such a flow or paywall contains both what should be shown within it and how it should be shown.

This guide covers flows and new Paywall Builder paywalls rendered by Adapty. The process differs for remote config paywalls and Observer mode.

To get the view object used below, see Get flows & paywalls.

To display a flow or paywall, use the view.Present() method on the view created by the CreateFlowView method. Each view can only be used once: a dismissed view is destroyed. If you need to display the flow again, call CreateFlowView one more time to create a new view instance.

Reusing the same view without recreating it may result in an error.

view.Present((error) => {
    // handle the error
});

Want to see a real-world example of how Adapty SDK is integrated into a mobile app? Check out our sample apps, which demonstrate the full setup, including displaying paywalls, making purchases, and other basic functionality.

Show dialog

Use this method instead of native alert dialogs when a flow or paywall is presented on Android. On Android, regular alerts appear behind the flow view, which makes them invisible to users. This method ensures proper dialog presentation above the flow on all platforms.

var dialog = new AdaptyUIDialogConfiguration()
    .SetTitle("Close this screen?")
    .SetContent("You will lose access to exclusive offers.")
    .SetDefaultActionTitle("Stay")
    .SetSecondaryActionTitle("Close");

AdaptyUI.ShowDialog(view, dialog, (action, error) => {
    if (error == null) {
        if (action == AdaptyUIDialogActionType.Secondary) {
            // User confirmed - close the flow
            view.Dismiss((error) => {
                // handle the error
            });
        }
        // If primary - do nothing, user stays
    }
});

Configure iOS presentation style

Configure how the flow or paywall is presented on iOS by passing the iosPresentationStyle parameter to the Present() method. The parameter accepts AdaptyUIIOSPresentationStyle.FullScreen (default) or AdaptyUIIOSPresentationStyle.PageSheet values.

view.Present(AdaptyUIIOSPresentationStyle.PageSheet, (error) => {
    // handle the error
});

If you’ve customized a paywall using the Paywall Builder, you don’t need to worry about rendering it in your mobile app code to display it to the user. Such a paywall contains both what should be shown within the paywall and how it should be shown.

This guide covers the new Paywall Builder, which requires Adapty SDK 3.3.0 or later.

To present remote config paywalls, see Render paywalls designed with remote config.

To display a paywall, use the view.Present() method on the view created by the CreatePaywallView method. Each view can only be used once. If you need to display the paywall again, call CreatePaywallView one more to create a new view instance.

Reusing the same view without recreating it may result in an AdaptyUIError.viewAlreadyPresented error.

view.Present((error) => {
  // handle the error
});

Want to see a real-world example of how Adapty SDK is integrated into a mobile app? Check out our sample apps, which demonstrate the full setup, including displaying paywalls, making purchases, and other basic functionality.

Show dialog

Use this method instead of native alert dialogs when a paywall view is presented on Android. On Android, regular alerts appear behind the paywall view, which makes them invisible to users. This method ensures proper dialog presentation above the paywall on all platforms.

var dialog = new AdaptyUIDialogConfiguration()
    .SetTitle("Close paywall?")
    .SetContent("You will lose access to exclusive offers.")
    .SetDefaultActionTitle("Stay")
    .SetSecondaryActionTitle("Close");

AdaptyUI.ShowDialog(view, dialog, (action, error) => {
    if (error == null) {
        if (action == AdaptyUIDialogActionType.Secondary) {
            // User confirmed - close the paywall
            view.Dismiss();
        }
        // If primary - do nothing, user stays
    }
});

Configure iOS presentation style

Configure how the paywall is presented on iOS by passing the iosPresentationStyle parameter to the Present() method. The parameter accepts AdaptyUIIOSPresentationStyle.FullScreen (default) or AdaptyUIIOSPresentationStyle.PageSheet values.

view.Present(AdaptyUIIOSPresentationStyle.PageSheet, (error) => {
    // handle the error
});