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 SDK command


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) throws DecryptionException

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 value 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 value 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 a 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<TemplateBanner» yes - Success data callback with valid banners.
errorListener DataActionListener<ApiError> 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<TemplateBanner> 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<List<SynerisePushResponse» with a parameterized list of SynerisePushResponse to execute a request.

Example

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

Register for push


Register for push messages.

Method name: Client.registerForPush(firebaseId)

Declaration

public static IApiCall registerForPush(@NonNull String firebaseId, boolean mobilePushAgreement)

Parameters

Parameter Type Mandatory Default Description
firebaseId String yes - FirebaseInstanceId
mobilePushAgreement boolean yes - Agreement (consent) for mobile push campaigns

Return Value

IApiCall object to execute the request.

Example

IApiCall call = Client.registerForPush(refreshedToken, true);
            call.execute(() -> Log.d(TAG, "Register for Push succeed: " + refreshedToken),
                         apiError -> Log.w(TAG, "Register for push failed: " + refreshedToken));
😕

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