Modules
Synerise
Main Synerise module responsible for whole SDK. This class is responsible for initialization of SDK.
Declared In:
com.synerise.sdk.core.Synerise
Declaration:
public class Synerise
Properties:
Property | Type | Optional | Default | Description |
---|---|---|---|---|
settings | Settings | no | - | Configuration of whole SDK |
Initializers:
There is a builder.
Methods:
Method to get applicationContext.
public static Context getApplicationContext()
Method that generates the document assigned to a slug.
public static String getClientApiKey()
Get application ID.
public static String getAppId()
Get base URL.
public static String getBaseUrl()
Get flag indicating debugMode state.
public static boolean getSyneriseDebugMode()
Synerise Builder
Synerise builder class.
Declared In:
com.synerise.sdk.core.Synerise.Builder
Declaration:
public static class Builder
Properties:
Property | Type | Optional | Default | Description |
---|---|---|---|---|
app | Application | no | - | Application context |
clientApiKey | String | no | - | Client apiKey. Can be retrieved from app.synerise.com |
applicationId | String | no | - | Application ID |
baseUrl | String | no | - | Base URL in the SDK. Can be null |
syneriseDebugMode | Boolean | no | - | Debug mode flag |
notificationIcon | int | no | R.drawable.synerise_ic_default_icon | Notification icon |
notificationIconColor | int | no | R.color.syneriseGrayTranslucent | Notification color |
channelDefaultName | String | no | - | Default notification channel name |
channelDefaultId | String | no | - | Default notification channel ID |
channelHighPriorityName | String | no | - | High priority notification channel name |
channelHighPriorityId | String | no | - | High priority notification channel ID |
pushListener | OnRegisterForPushListener | no | - | Push listener |
locationListener | OnLocationUpdateListener | no | - | Location listener |
crashHandlingEnabled | Boolean | no | - | Crash handling flag |
hostApplicationType | HostApplicationType | yes | - | Host application type |
hostApplicationSDKPluginVersion | String | yes | - | Synerise SDK plugin version in the host application |
setRequestValidationSalt | String | yes | - | Synerise Profile salt string for request validation |
Initializers:
Start initializing Synerise SDK with this method.
To get the Workspace API Key (formerly Business) and Profile API Key (formerly Client), sign in to your Synerise account and go to Settings > API Key.
Then, copy or generate a new API Key for the workspace and API Key for profiles.
public static Builder with(Application app, String clientApiKey, String appId)
Use this method to finish the initialization process.
public void build()
Methods:
This method sets the icon that will be used as the small icon in notifications.
It must be a drawable resource (not a mipmap) due to Android Oreo adaptive icons restrictions.
public Builder notificationIcon(@DrawableRes int notificationIcon)
This method sets the notification icon and text color.
notificationIconColor
must be in ARGB format.
public Builder notificationIconColor(int notificationIconColor)
This method enables/disables logcat logs from Synerise SDK.
It is not recommended to use debug mode in the release version of your application.
public Builder syneriseDebugMode(boolean syneriseDebugMode)
This method passes info about Users application crashes as dedicated events to the backend.
It is recommended to use SyneriseCrashHandling
.
public Builder crashHandlingEnabled(boolean exceptionHandlerEnabled)
It is important to register your profiles for push messages, so Synerise SDK may ask you to register a profile for push notifications.
This callback is called after the profile signs in, signs up, or deletes the account.
public Builder pushRegistrationRequired(@NonNull OnRegisterForPushListener listener)
This callback is called on demand by push notification, so it may be called at any time.
Check out the sample application for example usage and remember to send.
public Builder locationUpdateRequired(@NonNull OnLocationUpdateListener listener)
You can provide your custom base URL to use your own API.
For example, Synerise base URL is https://api.snrapi.com/
public Builder baseUrl(String baseUrl)
You can provide your notification channel name.
By default, the channel name is set to your application name.
public Builder notificationDefaultChannelName(@NonNull String name)
You can provide your notification channel ID.
public Builder notificationDefaultChannelId(@NonNull String channelId)
You can provide your High Priority notification channel name.
From default, channel name is set to <your application name> High Priority
public Builder notificationHighPriorityChannelName(@NonNull String name)
You can provide your High Priority notification channel ID.
public Builder notificationHighPriorityChannelId(@NonNull String channelId)
You can set the Synerise SDK host application type.
public Builder hostApplicationType(HostApplicationType type)
You can set Synerise the SDK plugin version of the host application.
public Builder hostApplicationSDKPluginVersion(@NonNull String version)
Client
Module responsible for all operations connected with a profile (formerly client).
Declared In:
com.synerise.sdk.client.Client
Declaration:
public abstract class Client
Properties:
There are no properties.
Initializers:
There are no initializers.
Methods:
This method sets ClientStateChangeListener to get optional callbacks.
public static void setOnClientStateChangeListener(OnClientStateChangeListener listener)
This method removes ClientStateChangeListener.
public static void removeClientStateChangeListener()
This method changes a Profile (formerly Client) API key dynamically.
public static void changeApiKey(@NonNull String apiKey)
This method changes a Profile (formerly Client) API key dynamically, with additional parameters.
public static void changeApiKey(String apiKey, InitializationConfig initializationConfig)
This method registers a new customer with an email, password, and optional data.
public static IApiCall registerAccount(@NonNull RegisterClient registerClient)
This method confirms a customer account with the confirmation token.
public static IApiCall confirmAccount(String token)
This method activates a customer with email.
public static IApiCall activateAccount(String email)
This method requests a customer’s account registration process with the PIN code.
public static IApiCall requestAccountActivationByPin(String email)
This method confirms a customer’s account registration process with the PIN code.
public static IApiCall confirmAccountActivationByPin(String pinCode, String email)
This method signs a customer in to obtain a JSON Web Token (JWT) which can be used in subsequent requests.
public static IApiCall signIn(@NonNull String email, @NonNull String password)
This method signs a customer in to obtain a JSON Web Token (JWT) which can be used in subsequent requests.
public static IDataApiCall<AuthConditions> signInConditionally(@NonNull String email, @NonNull String password)
This method authenticates a customer with OAuth, Facebook, Google, Apple, or Synerise.
public static IApiCall authenticate(@NonNull String token, @NonNull ClientIdentityProvider provider, @Nullable Agreements agreements, @Nullable Attributes attributes, @Nullable String authId)
This method authenticates a customer with OAuth, Facebook, Google, Apple, or Synerise.
public static IDataApiCall<AuthConditions> authenticateConditionally(@NonNull String token, @NonNull ClientIdentityProvider provider, @Nullable Agreements agreements, @Nullable Attributes attributes, @Nullable String authId)
This method authenticates a customer with OAuth.
public static IApiCall authenticateByOAuth(@NonNull String accessToken, @Nullable Agreements agreements, @Nullable Attributes attributes, @Nullable String authId)
This method authenticates a customer with OAuth.
public static IApiCall authenticateByOAuthIfRegistered(@NonNull String accessToken, @Nullable String authId)
This method authenticates a customer with Facebook.
public static IApiCall authenticateByFacebook(@NonNull String facebookToken, @Nullable Agreements agreements, @Nullable Attributes attributes, @Nullable String authId)
This method authenticates a customer with Facebook.
public static IApiCall authenticateByFacebookIfRegistered(@NonNull String facebookToken, @Nullable String authId)
This method signs in a customer in with the provided token payload.
public static IApiCall authenticateWithTokenPayload(TokenPayload tokenPayload, @NonNull String authId)
This method authenticates a customer with Simple Authentication.
public static IApiCall simpleAuthentication(ClientData clientData, String authId)
This method checks if a customer is signed in (via RaaS, OAuth, Facebook, Apple).
public static boolean isSignedIn()
This method checks if a customer is signed in (via Simple Authentication).
public static boolean isSignedInViaSimpleAuthentication()
This method signs out a customer out.
public static void signOut()
This method signs out a customer out with a chosen mode.
public static void signOut(ClientSignOutMode mode)
This method signs out a customer out with a chosen mode and Determines if the method should sign out all devices
public static IApiCall signOut(ClientSignOutMode mode, Boolean signOutFromAllDevices)
This method refreshes the customer’s current token.
public static IApiCall refreshToken()
This method retrieves the customer’s current, active token.
public static IDataApiCall<Token> getToken()
[(Click for more details)](/developers/mobile-sdk/method-reference/android/client-session/#get-customer-token)
This method retrieves the customer’s current UUID.
public static String getUuid()
Retrieves the current UUID or generates a new one from a seed.
public static String getUuidForAuthentication(@NonNull String authId)
This method regenerates the UUID and clears the authentication token, login session, custom email, and custom identifier.
public static boolean regenerateUuid()
This method regenerates the UUID and clears the authentication token, login session, custom email, and custom identifier.
public static boolean regenerateUuid(String clientIdentifier)
This method destroys the session completely.
public static void destroySession()
This method gets a customer’s account information.
public static IDataApiCall<GetAccountInformation> getAccount()
This method retrieves events for an authenticated customer.
public static IDataApiCall<List<ClientEventData>> getEvents(ClientEventsQuery clientEventsQuery)
This method updates a customer’s account’s basic information (without identification data: uuid, customId, email).
public static IApiCall updateAccountBasicInformation(@NonNull UpdateAccountBasicInformation accountInformation)
This method updates a customer’s account information.
public static IApiCall updateAccount(@NonNull UpdateAccountInformation accountInformation)
This method requests a customer’s password reset with email.
public static IApiCall requestPasswordReset(@NonNull PasswordResetRequest resetRequest)
This method confirm a customer’s password reset with the new password and token provided by password reset request.
public static IApiCall confirmPasswordReset(@NonNull PasswordResetConfirmation resetConfirmation)
This method changes a customer’s password.
public static IApiCall changePassword(@NonNull String oldPassword, @NonNull String password)
This method requests a customer’s email change.
public static IApiCall requestEmailChangeByFacebook(String email, @Nullable String uuid)
This method confirms an email change.
public static IApiCall confirmEmailChange(String token, boolean newsletterAgreement)
Requests a customer’s phone update. A confirmation code is sent to the phone number.
public static IApiCall requestPhoneUpdate(String phone)
This method confirms a phone number update. This action requires the new phone number and confirmation code as parameters.
public static IApiCall confirmPhoneUpdate(String phone, String confirmationCode, @Nullable Boolean smsAgreement)
This method deletes a customer’s account.
public static IApiCall deleteAccount(String clientAuthFactor, ClientIdentityProvider clientIdentityProvider, @Nullable String authId)
This method deletes a customer’s account.
public static IApiCall deleteAccount(String password)
This method deletes a customer’s account by OAuth.
public static IApiCall deleteAccountByOAuth(String accessToken, @Nullable String uuid)
This method deletes a customer’s account by Facebook.
public static IApiCall deleteAccountByFacebook(String facebookToken, @Nullable String uuid)
This method passes the Firebase Token to Synerise for notifications and doesn’t update the agreement of the profile.
public static IApiCall registerForPush(@NonNull String firebaseId)
This method passes the Firebase Token to Synerise for notifications.
public static IApiCall registerForPush(@NonNull String firebaseId, boolean mobilePushAgreement)
Tracker
Module responsible for sending events.
Declared In:
com.synerise.sdk.event.Tracker
Declaration:
public abstract class Tracker
Properties:
There are no properties.
Initializers:
There are no initializers.
Methods:
This method sets a custom identifier in the parameters of every event.
public static void setCustomIdentifier(String customIdentifier)
This method sets a custom email in the parameters of every event.
public static void setCustomEmail(String customEmail)
This method sends an event.
public static void send(Event event)
This method forces sending the events from the queue to the server.
public static void flush()
Injector
Module responsible for handling push notifications.
Declared In:
com.synerise.sdk.injector.Injector
Declaration:
public abstract class Injector
Properties:
There are no properties.
Initializers:
There are no initializers.
Methods:
This method handles a notification payload and starts activity.
public static boolean handlePushPayload(Bundle bundle)
public static boolean handlePushPayload(Map<String, String> pushPayload)
This method decrypts the notification payload.
public static Map<String, String> decryptPushPayload(Map<String, String> pushPayload) throws DecryptionException
This method verifies if a notification is encrypted.
public static boolean isPushEncrypted(Map<String, String> pushPayload)
This method verifies if a notification was sent by Synerise.
public static boolean isSynerisePush(Map<String, String> pushPayload)
This method verifies if a notification’s sender is Synerise and if the notification is a Silent Command.
public static boolean isSilentCommand(Map<String, String> pushPayload)
This method verifies if a notification’s sender is Synerise and if the notification is a Silent SDK Command.
public static boolean isSilentCommandSdk(Map<String, String> pushPayload)
This method verifies if a notification’s sender is Synerise and if the notification is a Simple Push campaign
public static boolean isSyneriseSimplePush(Map<String, String> pushPayload)
This method verifies if a notification’s sender is Synerise and if the notification is a Banner campaign.
public static boolean isSyneriseBanner(Map<String, String> pushPayload)
This method converts push payload into SilentCommand object.
public static SilentCommand getSilentCommand(Map<String, String> payload) throws ValidationException
This method fetches a walkthrough.
public static void getWalkthrough()
This method shows a walkthrough when it is loaded.
public static boolean showWalkthrough()
This method checks if a walkthrough is loaded.
public static boolean isWalkthroughLoaded()
This method checks if the walkthrough is unique compared to the previous one.
public static boolean isLoadedWalkthroughUnique()
This method fetches banners set for mobile campaigns and caches the valid ones.
public static void fetchBanners()
public static void fetchBanners(@NonNull final DataActionListener<List<TemplateBanner>> successListener,
@NonNull final DataActionListener<ApiError> errorListener)
This method provides valid banners directly from SDK cache.
public static List<TemplateBanner> getBanners()
This method shows a banner immediately.
public static void showBanner(TemplateBanner banner, boolean markPresented)
This method fetches Push Notifications set for mobile campaigns.
public static IDataApiCall<List<SynerisePushResponse>> getPushes()
Promotions
Module responsible for managing promotions.
Declared In:
com.synerise.sdk.promotions.Promotions
Declaration:
public abstract class Promotions
Properties:
There are no properties.
Initializers:
There are no initializers.
Methods:
This method retrieves all available promotions that are defined for a customer.
public static IDataApiCall<PromotionResponse> getPromotions()
This method retrieves all available promotions that are defined for a customer.
public static IDataApiCall<PromotionResponse> getPromotions(PromotionsApiQuery promotionsApiQuery)
This method retrieves the promotion with the specified UUID.
public static IDataApiCall<SinglePromotionResponse> getPromotionByUuid(@NonNull String uuid)
This method retrieves the promotion with the specified code.
public static IDataApiCall<SinglePromotionResponse> getPromotionByCode(@NonNull String code)
This method activates the promotion with the specified UUID.
public static IApiCall activatePromotionByUuid(@NonNull String uuid)
This method activates the promotion with the specified code.
public static IApiCall activatePromotionByCode(@NonNull String code)
This method deactivates the promotion with the specified UUID.
public static IApiCall deactivatePromotionByUuid(@NonNull String uuid)
This method deactivates the promotion with the specified code.
public static IApiCall deactivatePromotionByCode(@NonNull String code)
This method retrieves an assigned voucher code or assigns a voucher from a pool identified by UUID to the profile.
When the voucher is assigned for the first time, a voucherCode.assigned event is produced.
public static IDataApiCall<AssignVoucherResponse> getOrAssignVoucher(@NonNull String poolUuid)
This method assigns a voucher from a pool identified by UUID to the profile.
A voucherCode.assigned event is produced.
public static IDataApiCall<AssignVoucherResponse> assignVoucherCode(@NonNull String poolUuid)
This method retrieves voucher codes for a customer.
public static IDataApiCall<VoucherCodesResponse> getAssignedVoucherCodes()
Content
Module responsible for managing documents, reccommendations and content widget.
Declared In:
com.synerise.sdk.content.Content
Declaration:
public abstract class Content
Properties:
There are no properties.
Initializers:
There are no initializers.
Methods:
This method generates the document assigned to a slug.
public static IDataApiCall<Object> getDocument(String slugName)
This method generates the document that is defined for the provided slug.
public static IDataApiCall<Document> generateDocument(String slugName)
This method generates the document that is defined for parameters provided in the query object.
public static IDataApiCall<Document> generateDocument(DocumentApiQuery documentApiQuery)
This method generates documents that are defined for parameters provided in the query object.
public static IDataApiCall<List<Object>> getDocuments(DocumentsApiQuery documentsApiQuery)
This method generates recommendations that are defined for the options provided.
public static IDataApiCall<RecommendationResponse> getRecommendations(String slugName, RecommendationRequestBody options)
This method generates recommendations that are defined for the options provided.
public static IDataApiCall<RecommendationResponse> getRecommendationsV2(String slugName, RecommendationRequestBody options)
This method generates the customer’s highest-priority screen view campaign.
public static IDataApiCall<ScreenViewResponse> getScreenView()
This method generates a customer’s highest-priority screen view campaign from the feed with the provided feed slug.
public static IDataApiCall<ScreenView> generateScreenView(String feedSlug)
This method generates customer’s highest-priority screen view campaign that is defined for parameters provided in the query object.
public static IDataApiCall<ScreenView> generateScreenView(ScreenViewApiQuery screenViewApiQuery)