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 |
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)
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
Sign in a profile in order to obtain the JWT token, which can be used in subsequent requests. (Click for more details)
public static IApiCall signIn(@NonNull String email, @NonNull String password)
Sign out a profile and clear the token. (Click for more details)
public static void signOut()
Sign in with Facebook, Google, or OAuth. (Click for more details)
public static void authenticate(token, provider, agreements, attributes, authId)
@Deprecated method Sign in with Facebook. (Click for more details)
public static IApiCall authenticateByFacebook(@NonNull String facebookToken, @Nullable Agreements agreements, @Nullable Attributes attributes, @Nullable String authId)
Sign in with an already registered Facebook account. (Click for more details)
public static IApiCall authenticateByFacebookIfRegistered(@NonNull String facebookToken, @Nullable String authId)
@Deprecated method Sign in with OAuth. (Click for more details)
public static IApiCall authenticateByOAuth(@NonNull String accessToken, @Nullable Agreements agreements, @Nullable Attributes attributes, @Nullable String authId)
Sign in with an already registered OAuth account. (Click for more details)
public static IApiCall authenticateByOAuthIfRegistered(@NonNull String accessToken, @Nullable String authId)
Destroy a session. (Click for more details)
public static void destroySession()
Register a new profile with email, password, and optional data. (Click for more details)
public static IApiCall registerAccount(@NonNull RegisterClient registerClient)
Activate a profile with email. (Click for more details)
public static IApiCall activateAccount(String email)
Confirm a profile’s account with a token. (Click for more details)
public static IApiCall confirmAccount(String token)
Request a profile’s password reset with email. (Click for more details)
public static IApiCall requestPasswordReset(@NonNull PasswordResetRequest resetRequest)
Confirm a profile’s password reset with a new password and token provided by requestPasswordReset
(Click for more details)
public static IApiCall confirmPasswordReset(@NonNull PasswordResetConfirmation resetConfirmation)
Get a profile’s account information. (Click for more details)
public static IDataApiCall<GetAccountInformation> getAccount()
Update a profile’s account information with optional data. (Click for more details)
public static IApiCall updateAccount(@NonNull UpdateAccountInformation accountInformation)
Request an email change. (Click for more details)
public static IApiCall requestEmailChangeByFacebook(String email, @Nullable String uuid)
Delete an account by Facebook. (Click for more details)
public static IApiCall deleteAccountByFacebook(String facebookToken, @Nullable String uuid)
Delete an account by OAuth. (Click for more details)
public static IApiCall deleteAccountByOAuth(String accessToken, @Nullable String uuid)
Delete a profile’s account. (Click for more details)
public static IApiCall deleteAccount(String clientAuthFactor, ClientIdentityProvider clientIdentityProvider, @Nullable String authId)
Request a phone number update. This action requires additional validation with a PIN code. (Click for more details)
public static IApiCall requestPhoneUpdate(String phone)
Confirm a phone number update. (Click for more details)
public static IApiCall confirmPhoneUpdate(String phone, String confirmationCode, @Nullable Boolean smsAgreement)
Request an email change. (Click for more details)
public static IApiCall requestEmailChange(String email, String password, @Nullable String uuid)
Confirm an email change. (Click for more details)
public static IApiCall confirmEmailChange(String token, boolean newsletterAgreement)
Change a profile’s password. (Click for more details)
public static IApiCall changePassword(@NonNull String oldPassword, @NonNull String password)
Get JWT login token. (Click for more details)
public static IDataApiCall<Token> getToken()
[(Click for more details)](/developers/mobile-sdk/method-reference/android/client-session/#get-customer-token)
Refresh JWT token. (Click for more details)
public static IApiCall refreshToken()
Regenerate UUID and clear the authentication token. (Click for more details)
public static boolean regenerateUuid()
Regenerate UUID and clear the authentication token, login (if applicable), custom email, and custom identifier. (Click for more details)
public static boolean regenerateUuid(String clientIdentifier)
Change API Key dynamically. (Click for more details)
public static void changeApiKey(@NonNull String apiKey)
Retrieve current profile UUID. (Click for more details)
public static String getUuid()
Retrieve events for the authenticated profile. (Click for more details)
public static IDataApiCall<List<ClientEventData>> getEvents(ClientEventsQuery clientEventsQuery)
Check if a profile is signed in (the profile’s token is authorized). (Click for more details)
public static boolean isSignedIn()
Register for push notifications. (Click for more details)
public static IApiCall registerForPush(@NonNull String firebaseId, boolean mobilePushAgreement)
Set your own ClientStateChangeListener to get optional callbacks. (Click for more details)
public static void setOnClientStateChangeListener(OnClientStateChangeListener listener)
Remove your own ClientStateChangeListener. (Click for more details)
public static void removeClientStateChangeListener()
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
Your custom identifier will be sent within every event in event params. (Click for more details)
public static void setCustomIdentifier(String customIdentifier)
Your custom email will be sent within every event in event params. (Click for more details)
public static void setCustomEmail(String customEmail)
Send method adds new event to queue and sends available events to server if possible. (Click for more details)
public static void send(Event event)
Flush method forces sending events from queue to server. (Click for more details)
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 new push message and starts activity, which builds proper views from provided data. (Click for more details)
public static boolean handlePushPayload(Bundle bundle)
public static boolean handlePushPayload(Map<String, String> pushPayload)
This method decrypts push payload. (Click for more details)
public static Map<String, String> decryptPushPayload(Map<String, String> pushPayload) throws DecryptionException
This method only checks whether provided push data is encrypted by Synerise. (Click for more details)
public static boolean isPushEncrypted(Map<String, String> pushPayload)
This method only checks whether provided push data comes from Synerise. (Click for more details)
public static boolean isSynerisePush(Map<String, String> pushPayload)
This method only checks whether provided push data comes from Synerise and is it specifically Synerise Silent Command. (Click for more details)
public static boolean isSilentCommand(Map<String, String> pushPayload)
This method only checks whether provided push data comes from Synerise and whether it is specifically Synerise Silent SDK Command. (Click for more details)
public static boolean isSilentCommandSdk(Map<String, String> pushPayload)
This method only checks whether provided push data comes from Synerise and whether it is specifically Synerise Simple Push. (Click for more details)
public static boolean isSyneriseSimplePush(Map<String, String> pushPayload)
This method only checks whether provided push data comes from Synerise and whether it is specifically Synerise Banner. (Click for more details)
public static boolean isSyneriseBanner(Map<String, String> pushPayload)
Method that converts push payload into SilentCommand object. (Click for more details)
public static SilentCommand getSilentCommand(Map<String, String> payload) throws ValidationException
Cancels previous API request (if any) and then starts loading Walkthrough asynchronously. (Click for more details)
public static void getWalkthrough()
Shows Walkthrough if one is loaded (with higher priority) or already cached. (Click for more details)
public static boolean showWalkthrough()
This method returns true if Walkthrough is already loaded. (Click for more details)
public static boolean isWalkthroughLoaded()
This method verifies whether loaded Walkthrough is different than previously presented. (Click for more details)
public static boolean isLoadedWalkthroughUnique()
This method sets your own Walkthrough listener to receive optional callbacks. (Click for more details)
public static void setOnWalkthroughListener(OnWalkthroughListener listener)
This method sets your own Walkthrough listener to receive optional callbacks. (Click for more details)
public static void removeWalkthroughListener()
This method cancels previous API request (if any) and then starts fetching available. (Click for more details)
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. (Click for more details)
public static List<TemplateBanner> getBanners()
This method shows banner immediately with no check. (Click for more details)
public static void showBanner(TemplateBanner banner, boolean markPresented)
This method sets your own banner listener to receive optional callbacks. (Click for more details)
public static void setOnBannerListener(OnBannerListener listener)
This method removes banner listener to stop receiving callbacks. (Click for more details)
public static void removeBannerListener()
This method gets all available simple and silent pushes for a profile. (Click for more details)
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
Use this method to get all possible combinations of promotions, which are defined for this profile. (Click for more details)
public static IDataApiCall<PromotionResponse> getPromotions()
Use this method to get all possible combinations of promotions, which are defined for this profile. In PromotionsApiQuery you can define sortKeys and filters. (Click for more details)
public static IDataApiCall<PromotionResponse> getPromotions(PromotionsApiQuery promotionsApiQuery)
Use this method to get a promotion. (Click for more details)
public static IDataApiCall<SinglePromotionResponse> getPromotionByUuid(@NonNull String uuid)
Use this method to get a promotion. (Click for more details)
public static IDataApiCall<SinglePromotionResponse> getPromotionByCode(@NonNull String code)
Use this method to activate a promotion that has UUID passed as a parameter. (Click for more details)
public static IApiCall activatePromotionByUuid(@NonNull String uuid)
Use this method to activate a promotion with a code passed as parameter. (Click for more details)
public static IApiCall activatePromotionByCode(@NonNull String code)
Use this method to deactivate a promotion that has UUID passed as parameter. (Click for more details)
public static IApiCall deactivatePromotionByUuid(@NonNull String uuid)
Use this method to deactivate promotion with a code passed as parameter. (Click for more details)
public static IApiCall deactivatePromotionByCode(@NonNull String code)
Use this method to get a voucher code only once or assign a voucher with the provided UUID pool for the profile. (Click for more details)
public static IDataApiCall<AssignVoucherResponse> getOrAssignVoucher(@NonNull String poolUuid)
Use this method to assign a voucher with the provided UUID pool for the profile. (Click for more details)
public static IDataApiCall<AssignVoucherResponse> assignVoucherCode(@NonNull String poolUuid)
Use this method to get profile’s voucher codes. (Click for more details)
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
Method that returns a list of recommendations assigned to a slug. (Click for more details)
public static IDataApiCall<RecommendationResponse> getRecommendations(String slugName, RecommendationRequestBody options)
Method that generates the document assigned to a slug. (Click for more details)
public static IDataApiCall<Object> getDocument(String slugName)
Method that generates all documents assigned to a schema. (Click for more details)
public static IDataApiCall<List<Object>> getDocuments(DocumentsApiQuery documentsApiQuery)