Banner
Overview
A banner is a fullscreen creation presented when the app is active. When the app is in the background or destroyed, a simple push appears instead.
It is not always suitable for you to display every incoming banner, because the application may be in a state where you don’t want to interrupt the customer, so you can control its behavior.
The banner campaign can have different layouts:
color_as_background
image_as_background
image_with_text_atop
image_with_text_below
Configuration
Banner campaign is served by push notifications. See:
- Configuring push notifications - Android
- Configuring push notifications - iOS
- Configuring push notifications - React Native
- Configuring push notifications - Flutter
Additionally, check possible available configuration options in the Settings.
Handling actions from banners
Handling main actions from campaigns depends on the campaign type and operating system and it is described here.
Controlling behavior and actions
You may control incoming banner campaigns and decide whether to show them. By default, the SDK allows banner display.
You can also be notified (in the form of events) about the campaign actions in the following cases:
- When the banner is successfully created and presented to the customer.
- When the banner disappeared.
You can handle it using:
- OnBannerListener methods for Android.
- InjectorBannerDelegate methods for iOS.
- InjectorBannerListener methods for React Native.
- InjectorWalkthroughListener methods for Flutter.
See the following code samples:
public static OnBannerListener NULL = new OnBannerListener() {
// This method is called after a banner is loaded and Synerise SDK asks for permission to show it.
@Override
public boolean shouldPresent(TemplateBanner banner) {
return true;
}
// This method is called after a banner appears.
@Override
public void onPresented() {
//...
}
// This method is called after a banner disappears.
@Override
public void onClosed() {
//...
}
};
Payload
{
"data": {
"issuer": "Synerise",
"message-type": "dynamic-content",
"content-type": "template-banner",
"content": {
"campaign": {
"variant_id": 1,
"hash_id": "id1",
"type": "CAMPAIGN_TYPE",
"title": "CAMPAIGN_TITLE"
},
"page": {
"index": 0,
"type": "color_as_background",
"background": {
"color": "#ffffff",
"alpha": 1
},
"header": {
"text": "\n{ guard let }",
"color": "#000000",
"alpha": 1,
"size": 65
},
"description": {
"text": "\n\n#ios\n#development\n#videos\n#blog",
"color": "#555555",
"alpha": 1,
"size": 30
},
"button": {
"is_enabled": false,
"color": "#f9fafb",
"text": "URL: www.google.pl",
"text_color": "#384350",
"corner_radius": 5
},
"close_button": {
"is_enabled": true,
"alignment": "right"
},
"action": {
"type": "OPEN_URL",
"item": "http://www.google.pl"
}
}
}
}
}
Example
This is a banner campaign example with a background image.


Triggers
In order to show a banner immediately after a certain event occurred, you can send your banners from app.synerise.com with a trigger value.
Banners are fetched during the SDK initialization and while the application is running, these banners are searched for campaign triggers - it should have an identical value as the label of the tracked event.