Package com.swrve.sdk.config
Class SwrveConfigBase
- java.lang.Object
-
- com.swrve.sdk.config.SwrveConfigBase
-
- Direct Known Subclasses:
SwrveConfig
public abstract class SwrveConfigBase extends java.lang.Object
Configuration for the Swrve SDK.
-
-
Constructor Summary
Constructors Constructor Description SwrveConfigBase()
Create an instance of the SDK advance preferences.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
generateUrls(int appId)
Generate default endpoints with the given app id.java.lang.String
getAppStore()
java.lang.String
getAppVersion()
java.io.File
getCacheDir()
Cache folder used to save the in-app message images.java.net.URL
getContentUrl()
java.lang.String
getDbName()
SwrveEmbeddedMessageConfig
getEmbeddedMessageConfig()
The configuration file for EmbeddedMessages.java.net.URL
getEventsUrl()
int
getHttpTimeout()
The HTTP timeout used in the Swrve API calls.java.net.URL
getIdentityUrl()
SwrveInAppMessageConfig
getInAppMessageConfig()
The configuration file for InAppMessages.SwrveInitMode
getInitMode()
java.lang.String
getLanguage()
int
getMaxEventsPerFlush()
long
getMaxSqliteDbSize()
int
getMinSampleSize()
The sample size used when loading in-app message images.java.util.List<java.lang.String>
getModelBlackList()
long
getNewSessionInterval()
com.swrve.sdk.SwrveNotificationConfig
getNotificationConfig()
com.swrve.sdk.SwrvePushNotificationListener
getNotificationListener()
com.swrve.sdk.messaging.SwrveOrientation
getOrientation()
SwrveStack
getSelectedStack()
Get the selected Stackcom.swrve.sdk.SwrveSilentPushListener
getSilentPushListener()
com.swrve.sdk.SwrveSSLSocketFactoryConfig
getSSlSocketFactoryConfig()
boolean
isABTestDetailsEnabled()
boolean
isAndroidIdLoggingEnabled()
boolean
isAutoDownloadCampaignsAndResources()
boolean
isAutoStartLastUser()
boolean
isLoggingEnabled()
boolean
isSendQueuedEventsOnResume()
void
setABTestDetailsEnabled(boolean enabled)
void
setAndroidIdLoggingEnabled(boolean enabled)
SwrveConfigBase
setAppStore(java.lang.String appStore)
Set the App Store where the app will be distributed.SwrveConfigBase
setAppVersion(java.lang.String appVersion)
Set the app version.SwrveConfigBase
setAutoDownloadCampaignsAndResources(boolean autoDownload)
Download resources and in-app campaigns automatically.void
setAutoStartLastUser(boolean autoStartLastUser)
This configuration can only be used in initMode MANAGED.void
setCacheDir(java.io.File cacheDir)
Cache folder used to save the campaign images.SwrveConfigBase
setContentUrl(java.net.URL contentUrl)
Set to override the default location of the server used to obtain resources and in-app campaigns.SwrveConfigBase
setDbName(java.lang.String dbName)
Override the name of the internal SQLite database.void
setEmbeddedMessageConfig(SwrveEmbeddedMessageConfig embeddedMessageConfig)
The configuration file for EmbeddedMessages.SwrveConfigBase
setEventsUrl(java.net.URL eventsUrl)
Set to override the default location of the server to which Swrve will send analytics events.void
setHttpTimeout(int httpTimeout)
Set the HTTP timeout.SwrveConfigBase
setIdentityUrl(java.net.URL identityUrl)
Set to override the default location of the server user to identify user id If your company has a special API end-point enabled, then you should specify it here.void
setInAppMessageConfig(SwrveInAppMessageConfig inAppMessageConfig)
The configuration file for InAppMessages.void
setInitMode(SwrveInitMode initMode)
Set the SwrveInitMode to MANAGED to delay starting the sdk until start api is called.SwrveConfigBase
setLanguage(java.util.Locale locale)
Set the locale of the app.void
setLoggingEnabled(boolean enabled)
SwrveConfigBase
setMaxEventsPerFlush(int maxEventsPerFlush)
Set the maximum number of events per batch to the event server.SwrveConfigBase
setMaxSqliteDbSize(long maxSqliteDbSize)
Set the maximum byte size of the internal SQLite database.void
setMinSampleSize(int sampleSize)
Minimum sample size to use when loading in-app message images.void
setModelBlackList(java.util.List<java.lang.String> modelBlackList)
SwrveConfigBase
setNewSessionInterval(long newSessionInterval)
Set the session timeout time.void
setNotificationConfig(com.swrve.sdk.SwrveNotificationConfig notificationConfig)
void
setNotificationListener(com.swrve.sdk.SwrvePushNotificationListener notificationListener)
SwrveConfigBase
setOrientation(com.swrve.sdk.messaging.SwrveOrientation orientation)
Set the orientation to limit in-app messages.void
setSelectedStack(SwrveStack stack)
Set the stack prefix for the events and content urlvoid
setSendQueuedEventsOnResume(boolean sendQueuedEventsOnResume)
Automatically send events onResume.void
setSilentPushListener(com.swrve.sdk.SwrveSilentPushListener silentPushListener)
void
setSSlSocketFactoryConfig(com.swrve.sdk.SwrveSSLSocketFactoryConfig sslSocketFactoryConfig)
-
-
-
Method Detail
-
getSSlSocketFactoryConfig
public com.swrve.sdk.SwrveSSLSocketFactoryConfig getSSlSocketFactoryConfig()
-
setSSlSocketFactoryConfig
public void setSSlSocketFactoryConfig(com.swrve.sdk.SwrveSSLSocketFactoryConfig sslSocketFactoryConfig)
-
isAutoDownloadCampaignsAndResources
public boolean isAutoDownloadCampaignsAndResources()
- Returns:
- Whether campaigns and resources will automatically be downloaded.
-
setAutoDownloadCampaignsAndResources
public SwrveConfigBase setAutoDownloadCampaignsAndResources(boolean autoDownload)
Download resources and in-app campaigns automatically.- Parameters:
autoDownload
- Automatically download campaigns and resources.- Returns:
- the config object
-
getOrientation
public com.swrve.sdk.messaging.SwrveOrientation getOrientation()
- Returns:
- Orientation supported by the application.
-
setOrientation
public SwrveConfigBase setOrientation(com.swrve.sdk.messaging.SwrveOrientation orientation)
Set the orientation to limit in-app messages.- Parameters:
orientation
- Orientation supported by the application.- Returns:
- the config object
-
setLanguage
public SwrveConfigBase setLanguage(java.util.Locale locale)
Set the locale of the app. If empty or null then the default locale is used.- Parameters:
locale
- Locale of the app.- Returns:
- the config object
-
getLanguage
public java.lang.String getLanguage()
- Returns:
- Language of the app.
-
getSelectedStack
public SwrveStack getSelectedStack()
Get the selected Stack- Returns:
- The selected stack
-
setSelectedStack
public void setSelectedStack(SwrveStack stack)
Set the stack prefix for the events and content url- Parameters:
stack
- The chosen stack of the app
-
getMaxSqliteDbSize
public long getMaxSqliteDbSize()
- Returns:
- Maximum byte size of the internal SQLite database.
-
setMaxSqliteDbSize
public SwrveConfigBase setMaxSqliteDbSize(long maxSqliteDbSize)
Set the maximum byte size of the internal SQLite database.- Parameters:
maxSqliteDbSize
- Maximum size in bytes.- Returns:
- the config object
-
getMaxEventsPerFlush
public int getMaxEventsPerFlush()
- Returns:
- Maximum number of events per batch.
-
setMaxEventsPerFlush
public SwrveConfigBase setMaxEventsPerFlush(int maxEventsPerFlush)
Set the maximum number of events per batch to the event server.- Parameters:
maxEventsPerFlush
- Maximum number of events per batch.- Returns:
- the config object
-
getDbName
public java.lang.String getDbName()
- Returns:
- Name of the internal SQLite database.
-
setDbName
public SwrveConfigBase setDbName(java.lang.String dbName)
Override the name of the internal SQLite database.- Parameters:
dbName
- Name of the internal SQLite database.- Returns:
- the config object
-
getEventsUrl
public java.net.URL getEventsUrl()
- Returns:
- Location of the event server.
-
setEventsUrl
public SwrveConfigBase setEventsUrl(java.net.URL eventsUrl)
Set to override the default location of the server to which Swrve will send analytics events. If your company has a special API end-point enabled, then you should specify it here. You should only need to change this value if you are working with Swrve support on a specific support issue.- Parameters:
eventsUrl
- Custom location of the event server.- Returns:
- the config object
-
setIdentityUrl
public SwrveConfigBase setIdentityUrl(java.net.URL identityUrl)
Set to override the default location of the server user to identify user id If your company has a special API end-point enabled, then you should specify it here. You should only need to change this value if you are working with Swrve support on a specific support issue.- Parameters:
identityUrl
- Custom location of the identity server.- Returns:
- the config object
-
getIdentityUrl
public java.net.URL getIdentityUrl()
- Returns:
- Location of the identity server.
-
getContentUrl
public java.net.URL getContentUrl()
- Returns:
- Location of the content server.
-
setContentUrl
public SwrveConfigBase setContentUrl(java.net.URL contentUrl)
Set to override the default location of the server used to obtain resources and in-app campaigns. If your company has a special API end-point enabled, then you should specify it here. You should only need to change this value if you are working with Swrve support on a specific support issue.- Parameters:
contentUrl
- Custom location of the content server.- Returns:
- the config object
-
getAppVersion
public java.lang.String getAppVersion()
- Returns:
- App version.
-
setAppVersion
public SwrveConfigBase setAppVersion(java.lang.String appVersion)
Set the app version. If empty or null then PackageInfo.versionName will be used.- Parameters:
appVersion
- Version of the app.- Returns:
- the config object
-
getNewSessionInterval
public long getNewSessionInterval()
- Returns:
- Session timeout time in milliseconds.
-
setNewSessionInterval
public SwrveConfigBase setNewSessionInterval(long newSessionInterval)
Set the session timeout time. User activity after this time will be considered a new session.- Parameters:
newSessionInterval
- session timeout in milliseconds.- Returns:
- the config object
-
getAppStore
public java.lang.String getAppStore()
- Returns:
- the App Store where the app will be distributed.
-
setAppStore
public SwrveConfigBase setAppStore(java.lang.String appStore)
Set the App Store where the app will be distributed.- Parameters:
appStore
- App Store where the app will be distributed.- Returns:
- the config object
-
generateUrls
public void generateUrls(int appId) throws java.net.MalformedURLException
Generate default endpoints with the given app id. Used internally.- Parameters:
appId
- application id- Throws:
java.net.MalformedURLException
- If theres an error
-
getMinSampleSize
public int getMinSampleSize()
The sample size used when loading in-app message images.- Returns:
- sample size
-
setMinSampleSize
public void setMinSampleSize(int sampleSize)
Minimum sample size to use when loading in-app message images. Has to be a power of two.- Parameters:
sampleSize
- sample size
-
getCacheDir
public java.io.File getCacheDir()
Cache folder used to save the in-app message images.- Returns:
- cache folder
-
setCacheDir
public void setCacheDir(java.io.File cacheDir)
Cache folder used to save the campaign images. The default is Context.getCacheDir(). If permission to cacheDir is denied, then default is used.- Parameters:
cacheDir
- cache folder
-
isSendQueuedEventsOnResume
public boolean isSendQueuedEventsOnResume()
- Returns:
- Whether the SDK will send events onResume.
-
setSendQueuedEventsOnResume
public void setSendQueuedEventsOnResume(boolean sendQueuedEventsOnResume)
Automatically send events onResume.- Parameters:
sendQueuedEventsOnResume
- true to send queued event upon resume
-
setHttpTimeout
public void setHttpTimeout(int httpTimeout)
Set the HTTP timeout.- Parameters:
httpTimeout
- the http timeout for rest calls
-
getHttpTimeout
public int getHttpTimeout()
The HTTP timeout used in the Swrve API calls.- Returns:
- The timeout used in the HTTP calls
-
isAndroidIdLoggingEnabled
public boolean isAndroidIdLoggingEnabled()
- Returns:
- if it will automatically log Android ID as "swrve.android_id".
-
setAndroidIdLoggingEnabled
public void setAndroidIdLoggingEnabled(boolean enabled)
- Parameters:
enabled
- to enable automatic logging of Android ID "swrve.android_id".
-
isABTestDetailsEnabled
public boolean isABTestDetailsEnabled()
- Returns:
- if the SDK will request information about the AB Tests a user is part of.
-
setABTestDetailsEnabled
public void setABTestDetailsEnabled(boolean enabled)
- Parameters:
enabled
- to obtain information about the AB Tests a user is part of.
-
getModelBlackList
public java.util.List<java.lang.String> getModelBlackList()
- Returns:
- list of Android models where the SDK won't run, for example the 'Calypso AppCrawler'.
-
setModelBlackList
public void setModelBlackList(java.util.List<java.lang.String> modelBlackList)
- Parameters:
modelBlackList
- list of Android models where the SDK won't run, for example 'Calypso AppCrawler'.
-
isLoggingEnabled
public boolean isLoggingEnabled()
- Returns:
- if the SDK will log information to the console.
-
setLoggingEnabled
public void setLoggingEnabled(boolean enabled)
- Parameters:
enabled
- to control whether the SDK will log information to the console.
-
getNotificationConfig
public com.swrve.sdk.SwrveNotificationConfig getNotificationConfig()
- Returns:
- The custom SwrveNotificationConfig if one is set. If null, configuration from manifest will be attempted.
-
setNotificationConfig
public void setNotificationConfig(com.swrve.sdk.SwrveNotificationConfig notificationConfig)
- Parameters:
notificationConfig
- Set custom notification configurations
-
getNotificationListener
public com.swrve.sdk.SwrvePushNotificationListener getNotificationListener()
- Returns:
- The custom notification listener.
-
setNotificationListener
public void setNotificationListener(com.swrve.sdk.SwrvePushNotificationListener notificationListener)
- Parameters:
notificationListener
- Set custom notification listener to be executed when a notification is fired.
-
getSilentPushListener
public com.swrve.sdk.SwrveSilentPushListener getSilentPushListener()
- Returns:
- The custom silent push listener.
-
setSilentPushListener
public void setSilentPushListener(com.swrve.sdk.SwrveSilentPushListener silentPushListener)
- Parameters:
silentPushListener
- Set custom silent push listener to be executed when a silent push is received.
-
setInitMode
public void setInitMode(SwrveInitMode initMode)
Set the SwrveInitMode to MANAGED to delay starting the sdk until start api is called. Default mode is AUTO which automatically starts when UI is shown.- Parameters:
initMode
- change to managed to control when the SDK starts and with what user.
-
getInitMode
public SwrveInitMode getInitMode()
- Returns:
- The init mode.
-
setAutoStartLastUser
public void setAutoStartLastUser(boolean autoStartLastUser)
This configuration can only be used in initMode MANAGED.- Parameters:
autoStartLastUser
- If true, the sdk will delay starting until the start api is called and the userId is set. Once set, it will autostart when UI is shown. Set to false to force the sdk to always delay tracking until a start api is called.
-
isAutoStartLastUser
public boolean isAutoStartLastUser()
- Returns:
- the current value of autoStartLastUser
-
getInAppMessageConfig
public SwrveInAppMessageConfig getInAppMessageConfig()
The configuration file for InAppMessages.- Returns:
- the inApp config object
-
setInAppMessageConfig
public void setInAppMessageConfig(SwrveInAppMessageConfig inAppMessageConfig)
The configuration file for InAppMessages.- Parameters:
inAppMessageConfig
- object with in app configuration
-
getEmbeddedMessageConfig
public SwrveEmbeddedMessageConfig getEmbeddedMessageConfig()
The configuration file for EmbeddedMessages.- Returns:
- the embeddedMessage config object
-
setEmbeddedMessageConfig
public void setEmbeddedMessageConfig(SwrveEmbeddedMessageConfig embeddedMessageConfig)
The configuration file for EmbeddedMessages.- Parameters:
embeddedMessageConfig
- object with in app configuration
-
-