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
iOS
Purchasely SDK will provide a native UI View Controller, you can present it in the way you like.
The presentation will not respect safe areas, it is up to you to decide if you want to display it below or behind the notch.
However, the close button is rendered on top of the presentation and as such will respect automatically safe areas
Android
Purchasely SDK will provide a native Android View, you must add it to your layout hierarchy to be visible. You are in full control of its container (another View, a Fragment or an Activity) so you can decide how it will be rendered.
The presentation will not respect insets, it is up to you to decide if you want to display it below or behind the status bar and navigation bar.
However, the close button is rendered on top of the presentation and as such will respect automatically the top inset in portrait mode and right inset in landscape mode.
Flutter / React Native
Purchasely SDK will by default display a controller (iOS) / activity (android) on top of your Screen to display the paywall. You can control the Screen visibility to hide it to show your content and present it again afterwards.
Otherwise, you can also use Nested Views to display a Purchasely Screen inside your own component.
Cordova / Unity
Purchasely SDK will display a controller (iOS) / activity (android) on top of your Screen to display the paywall. You can control the Screen visibility to hide it to show your content and present it again afterwards.
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 method Purchasely.fetchPresentation()
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.
Updated 6 months ago