Tutorial: Mostrar un Banner por ID de Colocación
Sigue el código de ejemplo de este tutorial para mostrar Banners utilizando su ID de colocación. Para más información general, consulta Pancartas.
developer_guide/android/banners/tutorial_displaying_banners.md %}
Prerequisites
Before you can start this tutorial, verify that your Braze SDK meets the minimum version requirements:
Displaying banners for the Swift SDK
We’re piloting this new tutorial format. Tell us what you think — your feedback helps us improve future guides.
Prerequisites
Before you can start this tutorial, verify that your Braze SDK meets the minimum version requirements:
Displaying banners for the Web SDK
We’re piloting this new tutorial format. Tell us what you think — your feedback helps us improve future guides.
1. Enable debugging (optional)
To make troubleshooting easier while developing, consider enabling debugging.
2. Subscribe to Banner updates
Use subscribeToBannersUpdates()
to register a handler that runs whenever a Banner is updated. Inside the handler, call braze.getBanner("global_banner")
to get the latest placement.
3. Insert the Banner and handle control groups
Use braze.insertBanner(banner, container)
to insert a Banner when it’s returned. To ensure keep your layout clean, hide or collapse Banners that are apart of a control group (for example, when isControl
is true
).
4. Refresh your Banners
After initializing the SDK, call requestBannersRefresh(["global_banner", ...])
to ensure that Banners are refreshed at the start of each session.
You can also call this function at any time to refresh Banner placements later.
5. Add a container for your Banner
In your HTML, add a new <div>
element and give it a short, Banner-related id
, such as global-banner-container
. Braze will use this <div>
to insert your Banner into the page.