Notifications

Handle push payload


This method handles new push messages and starts an activity which builds views from the provided data.
Use this method when a new push arrives.
It is recommended to call this method from your FirebaseMessagingService subclass within the onMessageReceived(RemoteMessage) method.

Method name: handlePushPayload(bundle);
Method name: handlePushPayload(pushPayload);

Declaration

public static boolean handlePushPayload(Bundle bundle)
public static boolean handlePushPayload(Map<String, String> pushPayload)

Parameters

Parameter Type Mandatory Default Description
bundle Bundle yes - Bundle of data. Key “issuer” must be set to “Synerise”.
pushPayload Map<String, String> yes - Key-Value map of data. The “issuer” key must be set to “Synerise”.

Return Value

Boolean indicating if the incoming push contains an “issuer” key with the value “Synerise”.

Example

boolean isSynerisePush = Injector.handlePushPayload(getIntent().getExtras());

Is Synerise push


This method only checks if the provided push data comes from Synerise.

Method name: isSynerisePush(pushPayload);

Declaration

public static boolean isSynerisePush(Map<String, String> pushPayload)

Parameters

Parameter Type Mandatory Default Description
pushPayload Map<String, String> yes - Key-Value map of data. The “issuer” key must be set to “Synerise”.

Return Value

Boolean indicating if the incoming push contains an “issuer” key with the “Synerise” value.

Example

boolean isSynerisePush = Injector.isSynerisePush(data);

Is silent command


This method checks if the provided push data comes from Synerise and is a Synerise Silent Command.

Method name: isSilentCommand(pushPayload);

Declaration

public static boolean isSilentCommand(Map<String, String> pushPayload)

Parameters

Parameter Type Mandatory Default Description
pushPayload Map<String, String> yes - Key-Value map of data. The “issuer” key must be set to “Synerise”.

Return Value

Boolean indicating if the incoming push contains a “content-type” key with the “silent-command” value.

Example

boolean isSilentCommand = Injector.isSilentCommand(data);

Is silent command Sdk


This method checks if the provided push data comes from Synerise and is a Synerise Silent SDK Command.

Method name: isSilentCommandSdk(pushPayload);

Declaration

public static boolean isSilentCommandSdk(Map<String, String> pushPayload)

Parameters

Parameter Type Mandatory Default Description
pushPayload Map<String, String> yes - Key-Value map of data. The “issuer” key must be set to “Synerise”.

Return Value

Boolean indicating if the incoming push contains a “content-type” key with the “silent-sdk-command” value.

Example

boolean isSilentCommandSdk = Injector.isSilentCommandSdk(data);

Is Synerise simple Push


This method checks if the provided push data comes from Synerise and is a Synerise Simple Push.

Method name: isSyneriseSimplePush(pushPayload);

Declaration

public static boolean isSyneriseSimplePush(Map<String, String> pushPayload)

Parameters

Parameter Type Mandatory Default Description
pushPayload Map<String, String> yes - Key-Value map of data. The “issuer” key must be set to “Synerise”.

Return Value

Boolean indicating if the incoming push contains a “content-type” key with the “simple-push” value.

Example

boolean isSyneriseSimplePush = Injector.isSyneriseSimplePush(data);

Is Synerise banner


This method checks if the provided push data comes from Synerise and is a Synerise Banner.

Method name: isSyneriseBanner(pushPayload);

Declaration

public static boolean isSyneriseBanner(Map<String, String> pushPayload)

Parameters

Parameter Type Mandatory Default Description
pushPayload Map<String, String> yes - Key-Value map of data. The “issuer” key must be set to “Synerise”.

Return Value

Boolean indicating if the incoming push contains a “content-type” key with the “template-banner” value.

Example

boolean isSyneriseBanner = Injector.isSyneriseBanner(data);

Is Push encrypted


This method only checks whether provided push data is encrypted by Synerise.

Method name: isPushEncrypted(pushPayload);

Declaration

public static boolean isPushEncrypted(Map<String, String> pushPayload)

Parameters

Parameter Type Mandatory Default Description
pushPayload Map<String, String> yes - Key-Value map of data

Return Value

Boolean indicating if the incoming push is encrypted by Synerise.

Example

boolean isPushEncrypted = Injector.isPushEncrypted(data);

Decrypt push payload


This method decrypts push payload. If push is not encrypted, it returns raw payload.

Method name: decryptPushPayload(pushPayload);

Declaration

public static Map<String, String> decryptPushPayload(Map<String, String> pushPayload)

Parameters

Parameter Type Mandatory Default Description
pushPayload Map<String, String> yes - Key-Value map of data

Return Value

Key-Value map of data with the decrypted push.

Example

Injector.decryptPushPayload(data);

Get silent command


Method that converts push payload into a SilentCommand object.

Method name: getSilentCommand(payload);

Declaration

public static SilentCommand getSilentCommand(Map<String, String> payload) throws ValidationException

Parameters

Parameter Type Mandatory Default Description
payload Map<String, String> yes - payload received from push

Return Value

SilentCommand object, may be null if the payload is not a SilentCommand payload.

Example

SilentCommand silentCommand = Injector.getSilentCommand(payload);

Get walkthrough


Cancels a previous API request (if any) and then starts loading Walkthrough asynchronously.
To receive callbacks properly, this method should be called after Injector.setOnWalkthroughListener(OnWalkthroughListener).

Method name: getWalkthrough();

Declaration

public static void getWalkthrough()

Parameters

No parameters.

Return Value

No return value.

Example

Injector.getWalkthrough();

Show walkthrough


Shows Walkthrough if one is loaded (with a higher priority) or already cached.
This method may be called in your application at any time, as many times as you want.

Method name: showWalkthrough();

Declaration

public static boolean showWalkthrough()

Parameters

No parameters.

Return Value

Boolean is returned. true if the loaded or cached Walkthrough was presented, false otherwise.

Example

Injector.showWalkthrough();

Is walkthrough loaded


This methods indicates if Walkthrough is loaded or not.

Method name: isWalkthroughLoaded();

Declaration

public static boolean isWalkthroughLoaded()

Parameters

No parameters.

Return Value

Boolean is returned. true if Walkthrough is already loaded, false otherwise.

Example

Boolean isWalkthroughLoaded = Injector.isWalkthroughLoaded();

Is loaded walkthrough unique


This method verifies whether the loaded Walkthrough is different than previously presented.
Every time any Walkthrough is presented, it is cached locally, so you can control your flow more precisely.
It is also an enhanced version of Injector.isWalkthroughLoaded().

Note: Once Walkthrough is presented, it stops being unique.

Method name: isLoadedWalkthroughUnique();

Declaration

public static boolean isLoadedWalkthroughUnique()

Parameters

No parameters.

Return Value

Returns true if the loaded Walkthrough is loaded and different than previously presented, false otherwise.

Example

Boolean isWalkthroughLoadedUnique = Injector.isLoadedWalkthroughUnique();

Set Walkthrough listener


Set your own Walkthrough listener to receive optional callbacks.

Method name: setOnWalkthroughListener(listener);

Declaration

public static void setOnWalkthroughListener(OnWalkthroughListener listener)

Parameters

Parameter Type Mandatory Default Description
listener OnWalkthroughListener yes - Listener containing callbacks

Return Value

No value is returned.

Example

Injector.setOnWalkthroughListener(listener);

Remove Walkthrough listener


Remove Walkthrough listener to stop receiving callbacks.
It is recommended to call this method when your Activity is stopped.

Method name: removeWalkthroughListener();

Declaration

public static void removeWalkthroughListener()

Parameters

No parameters.

Return Value

No value is returned.

Example

Injector.removeWalkthroughListener();

Fetch banners


Cancels a previous API request (if any) and then starts fetching available banners and caches valid ones (overwriting existing ones).
To obtain these banners, use one of these methods:

  • Injector.fetchBanners()
  • Injector.fetchBanners(DataActionListener, DataActionListener) with data callback

Method name: fetchBanners();
Method name: fetchBanners(successListener, errorListener);

Declaration

public static void fetchBanners()
public static void fetchBanners(@NonNull final DataActionListener<List<TemplateBanner>> successListener,
                                    @NonNull final DataActionListener<ApiError> errorListener)

Parameters

Parameter Type Mandatory Default Description
successListener DataActionListener<List> yes - Success data callback with valid banners.
errorListener DataActionListener yes - Error callback with an ApiError instance.

Return Value

No value is returned.

Example

Injector.fetchBanners();

Get banners


This method provides valid banners from the SDK cache.

Note: The exact same banners are being searched for potential campaign triggers.

Method name: getBanners();

Declaration

public static List<TemplateBanner> getBanners()

Parameters

No parameters.

Return Value

List of cached banners.

Example

List<TemplateBanner> bannerList = Injector.getBanners();

Show banner


Show a banner immediately with no OnBannerListener.shouldPresent(TemplateBanner) check.
This method also validates if the provided banner wasn’t already presented before and if so, the banner is not presented.
Callbacks are fired anyway.

Method name: showBanner(banner, markPresented);

Declaration

public static void showBanner(TemplateBanner banner, boolean markPresented)

Parameters

Parameter Type Mandatory Default Description
banner TemplateBanner yes - Banner to display
markPresented boolean yes - Flag indicating if the banner should be marked as presented and not be presented the next time

Return Value

No value returned.

Example

Injector.showBanner(banner, markPresented);

Set banner listener


Set your own banner listener to receive optional callbacks.
Instantiate OnBannerListener and override the desired callbacks.

Method name: setOnBannerListener(banner, markPresented);

Declaration

public static void setOnBannerListener(OnBannerListener listener)

Parameters

Parameter Type Mandatory Default Description
listener OnBannerListener yes - Listener

Return Value

No value returned.

Example

Injector.setOnBannerListener(listener);

Remove banner listener


Remove banner listener to stop receiving callbacks.
It is recommended to call this method when your Activity is stopped.

Method name: removeBannerListener();

Declaration

public static void removeBannerListener()

Parameters

No parameters.

Return Value

No value returned.

Example

Injector.removeBannerListener();

Get pushes


Get all available simple and silent pushes for this customer.

Method name: getPushes();

Declaration

public static IDataApiCall<List<SynerisePushResponse>> getPushes()

Parameters

No parameters.

Return Value

IDataApiCall with a parameterized list of SynerisePushResponse to execute a request.

Example

IDataApiCall<List<SynerisePushResponse>> apiCall = Injector.getPushes();
        apiCall.execute(this::success, this::showAlertError);
😕

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.