public class ConfigCore
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ConfigCore.DID
Holder class for various ids metadata and id itself.
|
static class |
ConfigCore.LoggingLevel
Logging level for
Log module |
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
applicationName
Countly SDK name to be sent in HTTP requests
|
protected java.lang.String |
applicationVersion
Countly SDK version to be sent in HTTP requests
|
protected java.lang.Boolean |
automaticStarRatingShouldBeShown
If automatic star rating should be shown
|
protected boolean |
autoSessionsTracking
Automatically start session on app launch and stop it before it terminates
|
protected boolean |
autoViewsTracking
Automatically start a view on each activity start and stop it once activity is stopped
|
protected java.util.Set<java.lang.String> |
certificatePins
Enable SSL certificate pinning.
|
protected java.lang.String |
crashProcessorClass
CrashProcessor-implementing class which is instantiated when application
crashes or crash is reported programmatically using Usage.addCrashReport(Throwable, boolean, String, Map, String...). |
protected int |
crashReportingANRCheckingPeriod
When not
null, more than 0 and Feature.CrashReporting is enabled,
Countly watches main thread for unresponsiveness. |
protected java.lang.String |
customDeviceId
Developer specified device id
|
protected boolean |
deviceIdFallbackAllowed
Allow fallback from specified device id strategy to any other available strategy
|
protected int |
deviceIdStrategy
Device id generation strategy, UUID by default
|
protected java.lang.Boolean |
enableAutomaticRemoteConfig
If remote config automatic fetching should be enabled
|
protected int |
eventsBufferSize
Maximum number of events to hold until request is to be sent to the server
Events are also sent along with session update each
sendUpdateEachSeconds. |
protected int |
features
Set of Countly SDK features enabled
|
protected ConfigCore.LoggingLevel |
loggingLevel
Logging level
|
protected java.lang.String |
loggingTag
Tag used for logging
|
protected java.util.Map<java.lang.Integer,java.lang.Class<? extends Module>> |
moduleOverrides
Feature-Class map which sets Module overrides.
|
protected int |
networkConnectionTimeout
Connection timeout in seconds for HTTP requests SDK sends to Countly server.
|
protected int |
networkImportantRequestCooldown
How long to wait between Device ID change & push token requests, in milliseconds.
|
protected int |
networkReadTimeout
Read timeout in seconds for HTTP requests SDK sends to Countly server.
|
protected int |
networkRequestCooldown
How long to wait between requests in milliseconds.
|
protected java.util.Map<java.lang.String,java.lang.String> |
persistentParams
String-String map with custom parameters sent in each request, persistent.
|
protected java.util.Set<java.lang.String> |
publicKeyPins
Enable SSL public key pinning.
|
protected long |
ratingWidgetTimeout
After how much time the timeout error is returned when showing rating widget
|
protected java.lang.Long |
remoteConfigUpdateRequestTimeout
After how much time the request is canceled and timeout error returned
|
protected boolean |
requiresConsent
Requires GDPR-compliance calls.
|
protected java.lang.String |
salt
Salt string for parameter tampering protection
|
protected java.lang.String |
sdkName
Countly SDK name to be sent in HTTP requests
|
protected java.lang.String |
sdkVersion
Countly SDK version to be sent in HTTP requests
|
protected int |
sendUpdateEachSeconds
Maximum amount of time in seconds between two update requests to the server
reporting session duration and other parameters if any added between update requests.
|
protected java.lang.String |
serverAppKey
Application key of Countly server
|
protected java.net.URL |
serverURL
URL of Countly server
|
protected int |
sessionAutoCloseAfter
How much time of user inactivity Countly should wait until automatically ending session.
|
protected int |
sessionCooldownPeriod
Minimal amount of time between sessions in seconds.
|
protected java.lang.Boolean |
starRatingDisabledAutomaticForNewVersions
if star rating should be shown for each new version
|
protected java.lang.Boolean |
starRatingIsDialogCancelable
If star rating dialog should be cancellable
|
protected int |
starRatingSessionLimit
After how many sessions the automatic star rating is shown
|
protected java.lang.String |
starRatingTextDismiss
Star rating dialog dismiss message
|
protected java.lang.String |
starRatingTextMessage
Star rating dialog message
|
protected java.lang.String |
starRatingTextTitle
Star rating dialog title
|
protected boolean |
testMode
Enable test mode:
Raise exceptions when SDK is in inconsistent state as opposed to silently
trying to ignore it when testMode is off
Put Firebase token under
test devices if Feature.Push is enabled.
|
protected boolean |
usePOST
Force usage of POST method for all requests
|
| Constructor and Description |
|---|
ConfigCore(java.lang.String serverURL,
java.lang.String serverAppKey)
The only ConfigCore constructor.
|
| Modifier and Type | Method and Description |
|---|---|
ConfigCore |
addCertificatePin(java.lang.String pemEncodedCertificate)
Enable SSL certificate pinning.
|
ConfigCore |
addPublicKeyPin(java.lang.String pemEncodedPublicKey)
Enable SSL public key pinning.
|
ConfigCore |
disableANRCrashReporting()
Disable ANR detection and thus reporting to Countly server.
|
ConfigCore |
disableTestMode()
Disable test mode, so SDK will silently avoid raising exceptions whenever possible.
|
ConfigCore |
disableUpdateRequests()
Disable update requests completely.
|
ConfigCore |
enableParameterTamperingProtection(java.lang.String salt)
Enable parameter tampering protection
|
ConfigCore |
enableTestMode()
Enable test mode:
Raise exceptions when SDK is in inconsistent state as opposed to silently
trying to ignore them when testMode is off
Put Firebase token under
test devices if Feature.Push is enabled.
Note: this method automatically sets loggingLevel to ConfigCore.LoggingLevel.INFO in
case it was ConfigCore.LoggingLevel.OFF (default). |
ConfigCore |
enableUsePOST()
Force usage of POST method for all requests
|
java.lang.String |
getApplicationName()
Getter for
applicationName |
java.lang.String |
getApplicationVersion()
Getter for
applicationVersion |
java.util.Set<java.lang.String> |
getCertificatePins()
Getter for
certificatePins |
java.lang.String |
getCrashProcessorClass()
Getter for
crashProcessorClass |
int |
getCrashReportingANRCheckingPeriod()
Getter for
crashReportingANRCheckingPeriod |
java.lang.String |
getCustomDeviceId()
Getter for
customDeviceId |
int |
getDeviceIdStrategy()
Getter for
deviceIdStrategy |
int |
getEventsBufferSize()
Getter for
eventsBufferSize |
ConfigCore.LoggingLevel |
getLoggingLevel()
Getter for
loggingLevel |
java.lang.String |
getLoggingTag()
Getter for
loggingTag |
java.lang.Class<? extends Module> |
getModuleOverride(int feature)
Getter for
moduleOverrides |
int |
getNetworkConnectionTimeout()
Getter for
networkConnectionTimeout |
int |
getNetworkImportantRequestCooldown()
Getter for
networkImportantRequestCooldown |
int |
getNetworkReadTimeout()
Getter for
networkReadTimeout |
int |
getNetworkRequestCooldown()
Getter for
networkRequestCooldown |
java.lang.String |
getParameterTamperingProtectionSalt()
Getter for
salt |
java.util.Set<java.lang.String> |
getPublicKeyPins()
Getter for
publicKeyPins |
java.lang.String |
getSdkName()
Getter for
sdkName |
java.lang.String |
getSdkVersion()
Getter for
sdkVersion |
int |
getSendUpdateEachSeconds()
Getter for
sendUpdateEachSeconds |
java.lang.String |
getServerAppKey()
Getter for
serverAppKey |
java.net.URL |
getServerURL()
Getter for
serverURL |
int |
getSessionAutoCloseAfter()
Getter for
sessionAutoCloseAfter |
int |
getSessionCooldownPeriod()
Getter for
sessionCooldownPeriod |
boolean |
isAutoSessionsTrackingEnabled()
Getter for
autoSessionsTracking |
boolean |
isAutoViewsTrackingEnabled()
Getter for
autoSessionsTracking |
boolean |
isDeviceIdFallbackAllowed()
Whether to allow fallback from unavailable device id strategy to any other available.
|
boolean |
isFeatureEnabled(int feature)
Check if particular feature is enabled
|
boolean |
isTestModeEnabled()
Getter for
testMode |
boolean |
isUsePOST()
Getter for
usePOST |
protected ConfigCore |
overrideModule(java.lang.Integer feature,
java.lang.Class<? extends Module> cls)
Override some
Module functionality with your own class. |
boolean |
requiresConsent()
Getter for
requiresConsent |
ConfigCore |
setApplicationName(java.lang.String name)
Change application name reported to Countly server
|
ConfigCore |
setApplicationVersion(java.lang.String version)
Change application version reported to Countly server
|
ConfigCore |
setAutoSessionsTracking(boolean autoSessionsTracking)
Enable auto sessions tracking
|
ConfigCore |
setAutoViewsTracking(boolean autoViewsTracking)
Enable auto views tracking
|
ConfigCore |
setCrashProcessorClass(java.lang.Class<? extends CrashProcessor> crashProcessorClass)
Set crash processor class responsible .
|
ConfigCore |
setCrashReportingANRCheckingPeriod(int periodInSeconds)
Change period when a check for ANR is made.
|
ConfigCore |
setDeviceIdFallbackAllowed(boolean deviceIdFallbackAllowed)
Whether to allow fallback from unavailable device id strategy to Countly OpenUDID derivative.
|
ConfigCore |
setEventsBufferSize(int eventsBufferSize)
Sets maximum number of events to hold until forcing update request to be sent to the server
Update request is also sent when last update request was sent more than
setSendUpdateEachSeconds(int) seconds ago. |
ConfigCore |
setLoggingLevel(ConfigCore.LoggingLevel loggingLevel)
Logging level for Countly SDK
|
ConfigCore |
setLoggingTag(java.lang.String loggingTag)
Tag used for logging
|
ConfigCore |
setNetworkConnectTimeout(int seconds)
Set connection timeout in seconds for HTTP requests SDK sends to Countly server.
|
ConfigCore |
setNetworkImportantRequestCooldown(int milliseconds)
Set read timeout in seconds for HTTP requests SDK sends to Countly server.
|
ConfigCore |
setNetworkReadTimeout(int seconds)
Set read timeout in seconds for HTTP requests SDK sends to Countly server.
|
ConfigCore |
setNetworkRequestCooldown(int milliseconds)
How long to wait between requests in seconds.
|
ConfigCore |
setRequiresConsent(boolean requiresConsent)
Enable GDPR compliance by disallowing SDK to record any data until corresponding consent
calls are made.
|
ConfigCore |
setSdkName(java.lang.String sdkName)
Change name of SDK used in HTTP requests
|
ConfigCore |
setSdkVersion(java.lang.String sdkVersion)
Change version of SDK used in HTTP requests
|
ConfigCore |
setSendUpdateEachSeconds(int sendUpdateEachSeconds)
Set maximum amount of time in seconds between two update requests to the server
reporting session duration and other parameters if any added between update requests.
|
ConfigCore |
setSessionAutoCloseAfter(int sessionAutoCloseAfter)
Wait this much time before ending session in auto session tracking mode
|
ConfigCore |
setSessionCooldownPeriod(int sessionCooldownPeriod)
Set minimal amount of time between sessions in seconds.
|
ConfigCore |
setUsePOST(boolean usePOST)
Force usage of POST method for all requests.
|
protected final java.net.URL serverURL
protected final java.lang.String serverAppKey
protected int features
protected int deviceIdStrategy
protected boolean deviceIdFallbackAllowed
protected java.lang.String customDeviceId
protected java.lang.String loggingTag
protected ConfigCore.LoggingLevel loggingLevel
protected java.lang.String sdkName
protected java.lang.String sdkVersion
protected java.lang.String applicationName
protected java.lang.String applicationVersion
protected boolean usePOST
protected java.lang.String salt
protected int networkConnectionTimeout
protected int networkReadTimeout
protected int networkRequestCooldown
protected int networkImportantRequestCooldown
protected java.util.Set<java.lang.String> publicKeyPins
certificatePins) on the other hand have specific expiry date.
In case you chose this way of pinning, you MUST ensure that ALL installs of your app
have both certificates (old & new) until expiry date.protected java.util.Set<java.lang.String> certificatePins
publicKeyPins) is preferred over certificate pinning due to the fact
that public keys are usually not changed when certificate expires and you generate new one.
This ensures pinning continues to work after certificate prolongation.
Certificates on the other hand have specific expiry date.
In case you chose this way of pinning, you MUST ensure that ALL installs of your app
have both certificates (old & new) until expiry date.protected int sendUpdateEachSeconds
eventsBufferSize.
Set to 0 to disable update requests based on time.protected int eventsBufferSize
sendUpdateEachSeconds.
Set to 0 to disable buffering.protected int sessionCooldownPeriod
protected int sessionAutoCloseAfter
autoSessionsTracking set to true.protected boolean testMode
test devices if Feature.Push is enabled.protected int crashReportingANRCheckingPeriod
null, more than 0 and Feature.CrashReporting is enabled,
Countly watches main thread for unresponsiveness.
When main thread doesn't respond for time more than this property in seconds,
SDK reports ANR crash back to Countly server.protected java.lang.String crashProcessorClass
CrashProcessor-implementing class which is instantiated when application
crashes or crash is reported programmatically using Usage.addCrashReport(Throwable, boolean, String, Map, String...).
Crash processor helps you to add custom data in event of a crash: custom crash segments & crash logs.protected java.util.Map<java.lang.Integer,java.lang.Class<? extends Module>> moduleOverrides
protected java.util.Map<java.lang.String,java.lang.String> persistentParams
protected boolean requiresConsent
true, SDK waits for corresponding consent calls before recording any data.protected boolean autoSessionsTracking
protected boolean autoViewsTracking
protected java.lang.Boolean starRatingIsDialogCancelable
protected java.lang.Boolean starRatingDisabledAutomaticForNewVersions
protected long ratingWidgetTimeout
protected int starRatingSessionLimit
protected java.lang.String starRatingTextTitle
protected java.lang.String starRatingTextMessage
protected java.lang.String starRatingTextDismiss
protected java.lang.Boolean automaticStarRatingShouldBeShown
protected java.lang.Boolean enableAutomaticRemoteConfig
protected java.lang.Long remoteConfigUpdateRequestTimeout
public ConfigCore(java.lang.String serverURL,
java.lang.String serverAppKey)
serverURL - valid URL of Countly serverserverAppKey - App Key from Management -> Applications section of your Countly Dashboardpublic ConfigCore setDeviceIdFallbackAllowed(boolean deviceIdFallbackAllowed)
deviceIdFallbackAllowed - true if fallback is allowedthis instance for method chainingpublic ConfigCore enableUsePOST()
this instance for method chainingpublic ConfigCore setUsePOST(boolean usePOST)
usePOST - whether to force using POST method for all requests or notthis instance for method chainingpublic ConfigCore enableParameterTamperingProtection(java.lang.String salt)
salt - String to add to each request bebfore calculating checksumthis instance for method chainingpublic ConfigCore setLoggingTag(java.lang.String loggingTag)
loggingTag - tag string to usethis instance for method chainingpublic ConfigCore setLoggingLevel(ConfigCore.LoggingLevel loggingLevel)
loggingLevel - log level to usethis instance for method chainingpublic ConfigCore enableTestMode()
test devices if Feature.Push is enabled.loggingLevel to ConfigCore.LoggingLevel.INFO in
case it was ConfigCore.LoggingLevel.OFF (default).this instance for method chainingpublic ConfigCore disableTestMode()
this instance for method chainingpublic ConfigCore setSendUpdateEachSeconds(int sendUpdateEachSeconds)
setEventsBufferSize(int).sendUpdateEachSeconds - max time interval between two update requests, set to 0 to disable update requests based on time.this instance for method chainingpublic ConfigCore setEventsBufferSize(int eventsBufferSize)
setSendUpdateEachSeconds(int) seconds ago.eventsBufferSize - max number of events between two update requests, set to 0 to disable update requests based on events.this instance for method chainingpublic ConfigCore disableUpdateRequests()
this instance for method chainingsetSendUpdateEachSeconds(int),
setEventsBufferSize(int)public ConfigCore setSessionCooldownPeriod(int sessionCooldownPeriod)
sessionCooldownPeriod - min time interval between two sessionsthis instance for method chainingpublic ConfigCore setSdkName(java.lang.String sdkName)
sdkName - new name of SDKthis instance for method chainingpublic ConfigCore setSdkVersion(java.lang.String sdkVersion)
sdkVersion - new version of SDKthis instance for method chainingpublic ConfigCore setApplicationName(java.lang.String name)
name - new namethis instance for method chainingpublic ConfigCore setApplicationVersion(java.lang.String version)
version - new versionthis instance for method chainingpublic ConfigCore setNetworkConnectTimeout(int seconds)
seconds - network timeout in secondsthis instance for method chainingpublic ConfigCore setNetworkReadTimeout(int seconds)
seconds - read timeout in secondsthis instance for method chainingpublic ConfigCore setNetworkRequestCooldown(int milliseconds)
milliseconds - cooldown period in secondsthis instance for method chainingpublic ConfigCore setNetworkImportantRequestCooldown(int milliseconds)
milliseconds - read timeout in millisecondsthis instance for method chainingpublic ConfigCore addPublicKeyPin(java.lang.String pemEncodedPublicKey)
certificatePins) on the other hand have specific expiry date.
In case you chose this way of pinning, you MUST ensure that ALL installs of your app
have both certificates (old & new) until expiry date.
NOTE: when serverURL doesn't have "https://" public key pinning doesn't workpemEncodedPublicKey - PEM-encoded SSL public key string to addthis instance for method chainingpublic ConfigCore addCertificatePin(java.lang.String pemEncodedCertificate)
publicKeyPins) is preferred over certificate pinning due to the fact
that public keys are usually not changed when certificate expires and you generate new one.
This ensures pinning continues to work after certificate prolongation.
Certificates on the other hand have specific expiry date.
In case you chose this way of pinning, you MUST ensure that ALL installs of your app
have both certificates (old & new) until expiry date.
NOTE: when serverURL doesn't have "https://" certificate pinning doesn't workpemEncodedCertificate - PEM-encoded SSL certificate string to addthis instance for method chainingpublic ConfigCore setCrashReportingANRCheckingPeriod(int periodInSeconds)
Feature.CrashReporting.
Default period is 5 seconds. This is *NOT* a timeout for any possible time frame within app running time, it's a checking period.
Meaning *some* ANRs are to be recorded if main thread is blocked for slightly more than crashReportingANRCheckingPeriod.
Statistically it should be good enough as you don't really need all ANRs on the server.
*More* ANRs will be recorded in case main thread is blocked for 1.5 * crashReportingANRCheckingPeriod. Almost all ANRs
are going to be recorded once main thread is blocked for 2 * crashReportingANRCheckingPeriod or more seconds.
To disable ANR reporting, use disableANRCrashReporting().periodInSeconds - how much time the SDK waits between individual ANR checksthis instance for method chainingpublic ConfigCore disableANRCrashReporting()
this instance for method chainingpublic ConfigCore setCrashProcessorClass(java.lang.Class<? extends CrashProcessor> crashProcessorClass)
crashProcessorClass - CrashProcessor-implementing classthis instance for method chainingprotected ConfigCore overrideModule(java.lang.Integer feature, java.lang.Class<? extends Module> cls)
Module functionality with your own class.feature - feature index to overridecls - Class to use instead of Countly SDK standard classthis instance for method chainingpublic ConfigCore setRequiresConsent(boolean requiresConsent)
requiresConsent - true to enable GDPR compliancethis instance for method chainingpublic ConfigCore setAutoViewsTracking(boolean autoViewsTracking)
autoViewsTracking - whether to enable it or disablethis instance for method chainingautoViewsTrackingpublic ConfigCore setAutoSessionsTracking(boolean autoSessionsTracking)
autoSessionsTracking - whether to enable it or disablethis instance for method chainingautoSessionsTrackingpublic ConfigCore setSessionAutoCloseAfter(int sessionAutoCloseAfter)
sessionAutoCloseAfter - time in secondsthis instance for method chainingautoSessionsTrackingpublic boolean isAutoViewsTrackingEnabled()
autoSessionsTrackingautoSessionsTracking valuepublic boolean isAutoSessionsTrackingEnabled()
autoSessionsTrackingautoSessionsTracking valuepublic int getSessionAutoCloseAfter()
sessionAutoCloseAftersessionAutoCloseAfter valuepublic java.lang.String getServerAppKey()
serverAppKeyserverAppKey valuepublic int getDeviceIdStrategy()
deviceIdStrategydeviceIdStrategy valuepublic boolean isDeviceIdFallbackAllowed()
public java.lang.String getCustomDeviceId()
customDeviceIdcustomDeviceId valuepublic java.lang.String getParameterTamperingProtectionSalt()
saltsalt valuepublic java.lang.String getSdkVersion()
sdkVersionsdkVersion valuepublic boolean isFeatureEnabled(int feature)
feature - index of feature to checktrue if the feature is enabledpublic java.lang.String getApplicationName()
applicationNameapplicationName valuepublic java.lang.String getApplicationVersion()
applicationVersionapplicationVersion valuepublic java.lang.String getLoggingTag()
loggingTagloggingTag valuepublic ConfigCore.LoggingLevel getLoggingLevel()
loggingLevelloggingLevel valuepublic int getSendUpdateEachSeconds()
sendUpdateEachSecondssendUpdateEachSeconds valuepublic int getSessionCooldownPeriod()
sessionCooldownPeriodsessionCooldownPeriod valuepublic int getEventsBufferSize()
eventsBufferSizeeventsBufferSize valuepublic int getNetworkConnectionTimeout()
networkConnectionTimeoutnetworkConnectionTimeout valuepublic int getNetworkReadTimeout()
networkReadTimeoutnetworkReadTimeout valuepublic int getNetworkRequestCooldown()
networkRequestCooldownnetworkRequestCooldown valuepublic int getNetworkImportantRequestCooldown()
networkImportantRequestCooldownnetworkImportantRequestCooldown valuepublic java.util.Set<java.lang.String> getPublicKeyPins()
publicKeyPinspublicKeyPins valuepublic java.util.Set<java.lang.String> getCertificatePins()
certificatePinscertificatePins valuepublic int getCrashReportingANRCheckingPeriod()
crashReportingANRCheckingPeriodcrashReportingANRCheckingPeriod valuepublic java.lang.String getCrashProcessorClass()
crashProcessorClasscrashProcessorClass valuepublic java.lang.Class<? extends Module> getModuleOverride(int feature)
moduleOverridesmoduleOverrides value for Feature specifiedpublic boolean requiresConsent()
requiresConsentrequiresConsent value