Android listeners

OnRegisterForPushListener

onRegisterForPushRequired()

This method is called when Synerise needs registration for push notifications.

See Configuring push notifications for more details.

- void onRegisterForPushRequired();


OnNotificationListener

A listener to handle events from Synerise notifications.

See Configuring push notifications for more details.

Note: OnNotificationListener is available from 4.9.0 SDK version.

onNotificationReceived(NotificationInfo notificationInfo)

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.

onNotificationDismissed(NotificationInfo notificationInfo)

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.

onNotificationClicked(NotificationInfo notificationInfo)

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.

onActionButtonClicked(NotificationInfo notificationInfo, String actionButton)

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 listener to handle customer’s sign-in state changes.

To set your object with listener methods, you must use this method.

onClientSignedIn()

This method is called when the customer signs in.

- public void onClientSignedIn()

onClientSignedOut(ClientSessionEndReason reason)

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

onOpenUrl(InjectorSource source, String url)

A listener to handle events from campaigns.

Fired when a customer interacts with the URL action.
This method 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 value from the action of the activity

Fired when a customer interacts with the DEEP_LINKING action.
The method 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 Deep link value from the action of the activity


IWalkthroughListener

A listener to handle the states of walkthrough.

When you choose to load and present a walkthrough manually, you may be interested in the following delegate methods.

To set your object with listener methods, you must use this method.

Note: All these methods are optional and implementing them is not required. They are also called when a walkthrough was loaded automatically.

onLoaded(WalkthroughResponse walkthrough)

This method is called after a walkthrough is loaded.

- void onLoaded(WalkthroughResponse walkthrough)

onLoadingError(ApiError error)

This method is called when an error occurs while loading a walkthrough.

- void onLoadingError(ApiError error)

Parameter Type Description
error ApiError The error that occurred

onPresented()

This method is called after a walkthrough appears.

- void onPresented()

onClosed()

This method is called after a walkthrough disappears.

- void onClosed()



IBannerListener

A listener to handle the states of banner.

To set your object with listener methods, you must use this method.

shouldPresent(TemplateBanner banner)

This method is called after a banner is loaded and 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)}

onPresented()

This method is called after a banner appears.

- void onPresented()

onClosed()

This method is called after a banner disappears.

- void onClosed()



OnInAppListener

A listener to handle the states of in-app message.

Note: OnInAppListener is available from 4.7.0 SDK version.

To set your object with listener methods, you must use this method.

shouldShow(InAppMessageData inAppMessageData)

This method is called after an in-app message is loaded and Synerise SDK asks for permission to show it.

boolean shouldShow(InAppMessageData inAppMessageData)

Parameter Type Description
inAppMessageData InAppMessageData In-app message data.

onShown(InAppMessageData inAppMessageData)

This method is called after an in-app message appears.

void onShown(InAppMessageData inAppMessageData)

Parameter Type Description
inAppMessageData InAppMessageData In-app message data.

onDismissed(InAppMessageData inAppMessageData)

This method is called after an in-app message disappears.

void onDismissed(InAppMessageData inAppMessageData)

Parameter Type Description
inAppMessageData InAppMessageData In-app message data.

onContextFromAppRequired(InAppMessageData inAppMessageData)

This method is called when an individual context (for example a profile ID, an item SKU) for an in-app message is needed.

HashMap<String, Object> onContextFromAppRequired(InAppMessageData inAppMessageData)

Parameter Type Description
inAppMessageData InAppMessageData In-app message data.

onHandledOpenUrl(InAppMessageData inAppMessageData)

This method is called when the SRInApp.openUrl(url) method is used in an in-app message.

void onHandledOpenUrl(InAppMessageData inAppMessageData)

Parameter Type Description
inAppMessageData InAppMessageData In-app message data.

This method is called when the SRInApp.openDeeplink(url) method is used in an in-app message.

void onHandledOpenDeepLink(InAppMessageData inAppMessageData)

Parameter Type Description
inAppMessageData InAppMessageData In-app message data.

onCustomAction(String identifier, HashMap<String, Object> params, InAppMessageData inAppMessageData)

This method is called when the SRInApp.handleCustomAction(name, params) method is used in an in-app message.

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.


OnLocationUpdateListener

A listener to handle events about location.

onLocationUpdateRequired()

This method is called when the Tracker module requests a location update.

- void onLocationUpdateRequired()



OnContentWidgetListener

A listener to handle Content Widget actions.

onLoad(ContentWidget contentWidget)

This method is called after a widget is loaded.

- void onLoad(ContentWidget contentWidget)

Parameter Type Description
**contentWidget` ContentWidget The widget instance that called the listener method

onLoadingError(ContentWidget contentWidget, ApiError apiError)

This method is called when an error occurs while loading a widget.

- void onLoadingError(ContentWidget contentWidget, ApiError apiError)

Parameter Type Description
contentWidget ContentWidget The widget instance that called the listener method
apiError ApiError The error that occurred

onClickActionReceive(ContentWidget contentWidget, BaseModel model)

This method is called when the customer clicks a widget’s item.

- void onClickActionReceive(ContentWidget contentWidget, BaseModel model)

Parameter Type Description
contentWidget ContentWidget The widget instance that called the listener method
model BaseModel The model’s object that was clicked

onLoading(ContentWidget contentWidget, boolean isLoading)

This 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 listener method
isLoading Boolean Widget’s loading state

onSizeChange(ContentWidget contentWidget, ViewGroup.LayoutParams size)

This 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 listener method
size ViewGroup.LayoutParams Widget’s new size
😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker