Android listeners
OnRegisterForPushListener
It is important to register your customers for push messages, therefore Synerise SDK may request you to register a customer for push notifications.
This callback is called at after a customer signs in, signs up or deletes an account.
- void onRegisterForPushRequired();
OnNotificationListener
This method is called when a Synerise notification is received.
- public void onNotificationReceived(NotificationInfo notificationInfo)
Parameter | Type | Description |
---|---|---|
notificationInfo |
NotificationInfo |
Object providing info about the notification. |
This method is called when a Synerise notification is dismissed.
- public void onNotificationDismissed(NotificationInfo notificationInfo)
Parameter | Type | Description |
---|---|---|
notificationInfo |
NotificationInfo |
Object providing info about the notification. |
This method is called when a Synerise notification is clicked.
- public void onNotificationClicked(NotificationInfo notificationInfo)
Parameter | Type | Description |
---|---|---|
notificationInfo |
NotificationInfo |
Object providing information about the notification. |
This method is called when an action button is clicked in a Synerise notification.
- public void onActionButtonClicked(NotificationInfo notificationInfo, String actionButton)
Parameter | Type | Description |
---|---|---|
notificationInfo |
NotificationInfo |
Object providing information about the notification. |
actionButton |
String |
Text on the clicked action button. |
OnClientStateChangeListener
A callback to handle state of a customer.
This method is called when the customer signs in.
- public void onClientSignedIn()
This method is called when the customer signs out.
- public void onClientSignedOut(ClientSessionEndReason reason)
Parameter | Type | Description |
---|---|---|
reason |
ClientSessionEndReason | Specifies the reason for signing out. |
OnInjectorListener
A callback to handle events from campaigns.
Fired when a customer interacts with the URL action.
This callback returns true
if activity is closed after executing an action; in other case, it returns false
.
- boolean onOpenUrl(InjectorSource source, String url);
Parameter | Type | Description |
---|---|---|
source |
InjectorSource |
Interaction source |
url |
String |
URL provided from API |
Fired when a customer interacts with the DEEP_LINKING action.
The callback returns true
if activity is closed after executing the action; in other case, it returns false
.
- boolean onDeepLink(InjectorSource source, String deepLink);
Parameter | Type | Description |
---|---|---|
source |
InjectorSource |
Interaction source |
deepLink |
String |
deepLink provided from API |
IBannerListener
A callback to handle events from banner campaigns.
It is not always suitable for you to cover the screen every time a banner is received. You can implement optional methods to control this.
The following method is called after a banner is loaded and the Synerise SDK asks for permission to show it.
- boolean shouldPresent(TemplateBanner banner);
Parameter | Type | Description |
---|---|---|
banner |
TemplateBanner |
Banner’s necessary data for building process |
To create a banner with provided data, call {@link com.synerise.sdk.injector.Injector#showBanner(TemplateBanner, boolean)}
The following method is called after a banner appears.
- void onPresented();
The following method is called when a banner disappears.
- void onClosed();
OnInAppListener
A callback to handle events related to in-app messages.
This method is called when a message needs to be shown.
boolean shouldShow(InAppMessageData inAppMessageData)
Parameter | Type | Description |
---|---|---|
inAppMessageData |
InAppMessageData |
In-app message data. |
This method is called when a message is shown.
void onShown(InAppMessageData inAppMessageData)
Parameter | Type | Description |
---|---|---|
inAppMessageData |
InAppMessageData |
In-app message data. |
This method is called when a message was closed.
void onDismissed(InAppMessageData inAppMessageData);
Parameter | Type | Description |
---|---|---|
inAppMessageData |
InAppMessageData |
In-app message data. |
This method is called when the in-app message requires an individual context (for example a profile identifier, an item SKU).
HashMap<String, Object> onContextFromAppRequired(InAppMessageData inAppMessageData);
Parameter | Type | Description |
---|---|---|
inAppMessageData |
InAppMessageData |
In-app message data. |
This method is called when Synerise handles the URL action from in-app messages.
void onHandledOpenUrl(InAppMessageData inAppMessageData);
Parameter | Type | Description |
---|---|---|
inAppMessageData |
InAppMessageData |
In-app message data. |
This method is called when Synerise handles the deeplink action from in-app messages.
void onHandledOpenDeepLink(InAppMessageData inAppMessageData);
Parameter | Type | Description |
---|---|---|
inAppMessageData |
InAppMessageData |
In-app message data. |
This method is called when a custom action from an in-app message is handled.
void onCustomAction(String identifier, HashMap<String, Object> params, InAppMessageData inAppMessageData);
Parameter | Type | Description |
---|---|---|
inAppMessageData |
InAppMessageData |
In-app message data. |
identifier |
String |
Identifier of the custom action. |
params |
HashMap<String, Object> |
Custom action parameters. |
IWalkthroughListener
A callback to handle events from walkthrough campaigns.
When you choose to load and present a walkthrough manually, you may be interested in the following callback methods.
The following method is called after a walkthrough is loaded.
- void onLoaded(WalkthroughResponse walkthrough);
The following method is called when an error occurs while loading a walkthrough.
- void onLoadingError(ApiError error);
Parameter | Type | Description |
---|---|---|
error |
ApiError |
The error that occurred |
The following method is called after a walkthrough appears.
- void onPresented();
The following method is called after a walkthrough disappears.
- void onClosed();
OnLocationUpdateListener
A callback to handle events about location.
This callback is called on demand through a push notification, so it may be called at any time. Check out sample application for example usage and remember to send AppearedInLocationEvent.
- void onLocationUpdateRequired();
OnContentWidgetListener
A callback to handle Content Widget actions.
The following method is called after a widget is loaded.
- void onLoad(ContentWidget contentWidget);
Parameter | Type | Description |
---|---|---|
contentWidget |
ContentWidget |
The widget instance that called the callback method |
The following method is called when an error occurs while loading.
- void onLoadingError(ContentWidget contentWidget, ApiError apiError);
Parameter | Type | Description |
---|---|---|
contentWidget |
ContentWidget |
The widget instance that called the callback method |
apiError |
ApiError |
The error that occurred |
The following method is called when the customer clicks an item in the widget.
- void onClickActionReceive(ContentWidget contentWidget, BaseModel model);
Parameter | Type | Description |
---|---|---|
contentWidget |
ContentWidget |
The widget instance that called the callback method |
model |
BaseModel |
The model’s object that was clicked |
The following method is called when the widget’s loading state changes.
- void onLoading(ContentWidget contentWidget, boolean isLoading);
Parameter | Type | Description |
---|---|---|
contentWidget |
ContentWidget |
The widget instance that called the callback method |
isLoading |
Boolean |
Widget’s loading state |
The following method is called when the widget’s size changes.
- void onSizeChange(ContentWidget contentWidget, ViewGroup.LayoutParams size);
Parameter | Type | Description |
---|---|---|
contentWidget |
ContentWidget |
The widget instance that called the callback method |
size |
ViewGroup.LayoutParams |
Widget’s new size |