Set Synerise delegate
This method sets an object for Synerise delegate methods.
Declared In:
Headers/SNRSynerise.h
Related To:
SyneriseDelegate
Class:
Synerise
Declaration:
static func setDelegate(_ delegate: SyneriseDelegate)
+ (void)setDelegate:(SNRSyneriseDelegate *)delegate
Discussion:
Learn more about the methods and the purpose of this listener here.
Initialization
This method initializes Synerise.
NOTE: This method must be called before any other Synerise SDK method and only once during the application's lifecycle.
Declared In:
Headers/SNRSynerise.h
Class:
Synerise
Declaration:
static func initialize(apiKey: String) -> Void
+ (void)initializeWithApiKey:(NSString *)apiKey
NOTE: Before version 5.0.0, this method was called Synerise.initialize(clientApiKey:).
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| apiKey | String | yes | - | Synerise Profile (formerly Client) API Key |
Return Value:
No value is returned.
Example:
let apiKey = "YOUR_PROFILE_API_KEY"
Synerise.initialize(apiKey: apiKey)
static NSString *apiKey = @"YOUR_PROFILE_API_KEY";
[SNRSynerise initializeWithApiKey:apiKey];
Initialize with custom environment
This method initializes Synerise SDK with custom environment settings.
NOTE: This method must be called before any other Synerise SDK method and only once during the application's lifecycle.
Declared In:
Headers/SNRSynerise.h
Class:
Synerise
Declaration:
static func initialize(apiKey: String, baseUrl: String?) -> Void
+ (void)initializeWithApiKey:(NSString *)apiKey andBaseUrl:(nullable NSString *)baseUrl
NOTE: Before version 5.0.0, this method was called Synerise.initialize(clientApiKey:baseUrl:).
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| apiKey | String | yes | - | Synerise Profile (formerly Client) API Key |
| baseUrl | String | no | - | Synerise API custom environment base URL |
You can use one of the constants:
SyneriseApiUrls.SYNERISE_AZ_API_URL - https://api.snrapi.com
SyneriseApiUrls.SYNERISE_AZU_API_URL - https://api.azu.snrapi.com
SyneriseApiUrls.SYNERISE_GEB_API_URL - https://api.geb.snrapi.com
SNR_SYNERISE_AZ_API_URL - https://api.snrapi.com
SNR_SYNERISE_AZU_API_URL - https://api.azu.snrapi.com
SNR_SYNERISE_GEB_API_URL - https://api.geb.snrapi.com
Return Value:
No value is returned.
Example:
let apiKey = "YOUR_PROFILE_API_KEY"
let apiBaseUrl = "YOUR_API_BASE_URL"
Synerise.initialize(apiKey: apiKey, baseUrl: apiBaseUrl)
static NSString *apiKey = @"YOUR_PROFILE_API_KEY";
static NSString *apiBaseUrl = @"YOUR_API_BASE_URL";
[SNRSynerise initializeWithApiKey:apiKey andBaseUrl:apiBaseUrl];
Change Profile API Key dynamically
This method changes a Profile (formerly Client) API key dynamically.
Declared In:
Headers/SNRSynerise.h
Class:
Synerise
Declaration:
static func changeApiKey(_ apiKey: String) -> Void
+ (void)changeApiKey:(nonnull NSString *)apiKey
NOTE: Before version 5.0.0, this method was called Synerise.changeClientApiKey(_ clientApiKey:).
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| apiKey | String | yes | - | Synerise Profile API Key (formerly Client API key) |
Return Value:
No value is returned.
Change Profile API Key dynamically with config
This method changes a Profile (formerly Client) API key dynamically, with additional parameters. It can include a salt for Simple Profile Authentication requests.
| iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
|---|---|---|---|---|
| Introduced in: | 4.19.0 | 5.20.0 | 0.23.0 | 1.3.0 |
Declared In:
Headers/SNRSynerise.h
Class:
Synerise
Declaration:
static func changeApiKey(_ apiKey: String, config: InitializationConfig?) -> Void
+ (void)changeApiKey:(nonnull NSString *)apiKey config:(nullable SNRInitializationConfig *)config;
NOTE: Before version 5.0.0, this method was called Synerise.changeClientApiKey(_ clientApiKey:config:).
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| apiKey | String | yes | - | Synerise Profile API Key (formerly Client API key) |
| config | InitializationConfig | no | - | Object for additional initialization settings after the API key change |
Return Value:
No value is returned.
Set Request Validation Salt
This method sets the salt string for request validation.
| iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
|---|---|---|---|---|
| Introduced in: | 4.14.0 | 5.7.1 | 0.15.0 | 0.7.0 |
Declared In:
Headers/SNRSynerise.h
Class:
Synerise
Declaration:
static func setRequestValidationSalt(_: String?) -> Void
+ (void)setRequestValidationSalt:(nullable NSString *)string
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| salt | String | no | - | Synerise Profile salt string for request validation |
Return Value:
No value is returned.
Set up host application type
This method sets the Synerise SDK host application type.
| iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
|---|---|---|---|---|
| Introduced in: | 3.6.1 | 3.6.22 | - | - |
Declared In:
Headers/SNRSynerise.h
Class:
Synerise
Declaration:
static func setHostApplicationType(_ type: HostApplicationType) -> Void
+ (void)setHostApplicationType:(SNRHostApplicationType)type
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| type | HostApplicationType | yes | - | Specifies the type of host application |
Return Value:
No value is returned.
Set host application SDK plugin version
This method sets the Synerise SDK plugin version.
| iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
|---|---|---|---|---|
| Introduced in: | 4.14.6 | 5.11.0 | - | - |
Declared In:
Headers/SNRSynerise.h
Class:
Synerise
Declaration:
static func setHostApplicationSDKPluginVersion(_ version: String) -> Void
+ (void)setHostApplicationSDKPluginVersion:(NSString *)version
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| version | String | yes | - | Specifies the version of the Synerise SDK plugin in the host application |
Return Value:
No value is returned.
Enable Debug Mode
This method enables or disables console logs from Synerise SDK.
WARNING: It is not recommended to use debug mode in the release version of your application.
Declared In:
Headers/SNRSynerise.h
Class:
Synerise
Declaration:
static func setDebugModeEnabled(_: Bool) -> Void
+ (void)setDebugModeEnabled:(BOOL)enabled;
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| enabled | Bool | yes | - | Enables or disables console logs |
Return Value:
No value is returned.
Enable Crash Handling
This method enables or disables crash handling by Synerise SDK.
NOTE: If set to true, Synerise SDK will send the client.applicationCrashed event with information about crash.
Declared In:
Headers/SNRSynerise.h
Class:
Synerise
Declaration:
static func setCrashHandlingEnabled(_: Bool) -> Void
+ (void)setCrashHandlingEnabled:(BOOL)enabled
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| enabled | Bool | yes | - | Enables or disables crash handling |
Return Value:
No value is returned.
Set Background Task identifiers
This method sets identifiers for Background Tasks processing.
| iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
|---|---|---|---|---|
| Introduced in: | 4.23.0 | - | - | - |
IMPORTANT: Do not use those identifiers for other Background Tasks in your app.
Declared In:
Headers/SNRSynerise.h
Class:
Synerise
Declaration:
static func setBackgroundTaskIdentifiers(_: [String]) -> Void
+ (void)setBackgroundTaskIdentifiers:(NSArray<NSString *> *)identifiers
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| identifiers | [String] | yes | - | Identifiers for Background Tasks registered in the host application. The first element is the identifier of the Main Background Task. The second element (introduced in SDK version 6.1.0) is the identifier of the Request Retry Background Task. A Background Task without an identifier in the array is unregistered. |
Return Value:
No value is returned.
Set Main Background Task identifier
This method sets the identifier of the Main Background Task. The task refreshes the registration for Push Notifications every 20 days, even when the application is not running.
This method is equivalent to passing the identifier as the first element of the array in Synerise.setBackgroundTaskIdentifiers(_:). For more information, see Background Tasks.
| iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
|---|---|---|---|---|
| Introduced in: | 6.1.0 | - | - | - |
- The identifier must be listed in
BGTaskSchedulerPermittedIdentifiersinInfo.plist, and the Background processing mode must be enabled. - Invoke this method before the application finishes launching.
- Do not use this identifier for other Background Tasks in your app.
Declared In:
Headers/SNRSynerise.h
Class:
Synerise
Declaration:
static func setMainBackgroundTaskIdentifier(_: String) -> Void
+ (void)setMainBackgroundTaskIdentifier:(NSString *)identifier
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| identifier | String | yes | - | Identifier of the Main Background Task registered in the host application |
Return Value:
No value is returned.
Set Request Retry Background Task identifier
This method sets the identifier of the Request Retry Background Task. When the device is back online, the task re-sends requests that failed because of network problems, such as the registration for Push Notifications.
This method is equivalent to passing the identifier as the second element of the array in Synerise.setBackgroundTaskIdentifiers(_:). For more information, see Background Tasks.
| iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
|---|---|---|---|---|
| Introduced in: | 6.1.0 | - | - | - |
- The identifier must be listed in
BGTaskSchedulerPermittedIdentifiersinInfo.plist, and the Background processing mode must be enabled. - Invoke this method before the application finishes launching.
- Do not use this identifier for other Background Tasks in your app.
Declared In:
Headers/SNRSynerise.h
Class:
Synerise
Declaration:
static func setRequestRetryBackgroundTaskIdentifier(_: String) -> Void
+ (void)setRequestRetryBackgroundTaskIdentifier:(NSString *)identifier
Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| identifier | String | yes | - | Identifier of the Request Retry Background Task registered in the host application |
Return Value:
No value is returned.