HomeGuidesChangelogDiscussions
Log In
Guides

Controling Screen visibility

This section describes how to manage Screen's visibility

🚧

Minimum SDK versions

  • iOS: 5.3.0
  • Android: 5.3.0
  • ReactNative: 4.0.1
  • Cordova: 4.1.0
  • Flutter: 4.0.0
  • Unity: 4.1.0

Native iOS and Android

You can close all opened Purchasely screens programmatically calling the method close() on the presentation object currently displayed.

Purchasely.fetchPresentation(
    for: "onboarding",
     fetchCompletion: { presentation, error in
                    
 // when displayed, call close
 presentation.close()

)
Purchasely.fetchPresentation(placementId = "onboarding") { presentation, error ->
  // when displayed, call close
  presentation.close()
}

// Alternatively you can call this method at anytime
Purchasely.closeAllScreens()

React Native, Flutter, Cordova and Unity

Managing the visibility of screens in your application is essential for providing a seamless user experience. The Purchasely SDK allows you to control the visibility of screens, enabling you to:

  • Hide a Screen.
  • Show again a hidden Screen.
  • Close permanently a Screen.

To learn more about fetching and displaying screens using the Purchasely SDK, refer to the displaying screens documentation.

Implementation

Hide a Screen

Use Purchasely.hidePresentation() to hide a screen without closing it. This method is useful when you want to temporarily hide the screen and bring it back later.

Purchasely.hidePresentation()
Purchasely.hidePresentation()
Purchasely.hidePresentation()
private PurchaselyRuntime.Purchasely _purchasely

_purchasely.HidePresentation()

Show a Screen

Use Purchasely.showPresentation() to display a screen that was previously hidden using hidePresentation().

Purchasely.showPresentation()
Purchasely.showPresentation()
Purchasely.showPresentation()
private PurchaselyRuntime.Purchasely _purchasely

_purchasely.ShowPresentation()

Close a Screen

Use Purchasely.closePresentation() to close the current screen permanently. If you want to display the screen again after closing it, you will have to fetch it again by calling fetchPresentation method.

Purchasely.closePresentation()
Purchasely.closePresentation()
Purchasely.closePresentation()
private PurchaselyRuntime.Purchasely _purchasely

_purchasely.ClosePresentation()

What’s Next

Learn how to customize your Screens by nesting multiple views