Displaying Screens

This section describes how to manage the native views generated by the Purchasely SDK when displaying Screens

🚧

Native UI

Our SDK create Screen with native iOS and Android components, UI Kit and Android Views, for the best performance and compatibility. As such, some limitations may apply with a bridge sdk.

Purchasely will provide a native view to display in your application, consequently you can completely customize its behavior and its allocated Screen space to decide for example if you want to display it in full mode or in a pop-in

Overview

The SDK returns a native view, so you decide how and where it is displayed (full screen, pop-in, nested…).

PlatformWhat the SDK providesSafe areas / insetsClose button
iOSA native UIViewControllerpresent it however you likeNot respected by default — you decide whether to display below or behind the notchRendered on top, automatically respects safe areas
AndroidA native View — add it to your layout hierarchy (another View, a Fragment or an Activity)Not respected by default — you decide below or behind the status & navigation barsRendered on top, automatically respects the top inset (portrait) and right inset (landscape)
Flutter / React Native / CordovaA controller (iOS) / activity (Android) displayed on top of your Screen by defaultHandled by the native layerManaged by the SDK
📘

Screen Visibility

On Flutter, React Native and Cordova, you can control the Screen visibility to hide the paywall and present it again later, or use Nested Views to embed a Purchasely Screen inside your own component.

Placements

As a general rule, you should always use a Placement to display a Purchasely Screen. This allows you to display a different Screen based on an Audience or an A/B test or just change it without updating your code.

Learn more about displaying Screen with placements

Pre-fetching

You can pre-fetch a Screen with the PLYPresentationBuilder / PLYPresentation { }.preload API (iOS: PLYPresentationBuilder.forPlacementId(...).build().preload { }, Android: PLYPresentation { placementId(...) }.preload { }) so that all processing is done before showing it to your user. You also get access to more information like the audience id or ab test variant id of your user for the placement you have requested.

However, we do not advise to pre-fetch all screens at once as an Audience is attributed on request based on user attributes or subscription status that may change during the session of the user. Thus, we suggest to pre-fetch at start only your home placement and then fetch the Placement of the current touchpoint/Screen of your application when the user navigates.

Lear more about pre-fetching Screens

Display your own dialogs

On Purchasely Screens in full mode, the SDK will automatically display dialogs (aka pop-ins) to inform the user about the status of his action like a successful purchase or an error in his request. Those dialogs are displayed in the native format of the device according to the UI guidelines of Apple and Google.

If you wish to change the layout of those dialogs or change the content, you can implement a PLYUIHandler to display them yourselves.

Display deeplinks yourself

If you have setup deeplinks with Purchasely, the SDK will automatically display them in a specific UIViewController (iOS) or Activity (Android).
However, you can display a Purchasely Screen yourself inside your own View if you implement a PLYUIHandler.


Did this page help you?