Class LoggingAnalyticsProvider
java.lang.Object
com.codename1.analytics.AbstractAnalyticsProvider
com.codename1.analytics.LoggingAnalyticsProvider
- All Implemented Interfaces:
AnalyticsProvider
A provider that simply logs every call (and records them in memory) instead
of sending data anywhere. It is the recommended default in the simulator and
is used as the backing provider in unit tests, where
getLog() lets a
test assert exactly which calls were made.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclearLog()Clears the recorded call log.voidflush()Flushes any buffered events to the backend.getLog()The in-memory record of calls received by this provider, in order.getName()A short, stable, human readable name for this provider (used in logs and diagnostics).voidonConsentChanged(AnalyticsConsent consent) Notifies the provider that the user's consent has changed so it can enable, disable or reconfigure collection accordingly.voidreportCrash(AnalyticsCrashReport report) Reports a crash or handled exception.voidAssociates subsequent activity with a user identifier.voidsetUserProperty(String key, String value) Sets a user-level property / custom dimension.booleansupports(AnalyticsCapability capability) Indicates whether the provider supports a given capability.voidtrackEvent(AnalyticsEvent event) Records a named event.voidtrackScreen(String name, String referrer) Records a screen / page view.Methods inherited from class AbstractAnalyticsProvider
getContext, init
-
Constructor Details
-
LoggingAnalyticsProvider
public LoggingAnalyticsProvider()
-
-
Method Details
-
getName
Description copied from interface:AnalyticsProviderA short, stable, human readable name for this provider (used in logs and diagnostics).
Returns
the provider name
- Specified by:
getNamein interfaceAnalyticsProvider- Specified by:
getNamein classAbstractAnalyticsProvider
-
getLog
-
clearLog
public void clearLog()Clears the recorded call log. -
trackScreen
Description copied from interface:AnalyticsProviderRecords a screen / page view.
Parameters
-
name: the screen name -
referrer: the previous screen name, may be null
- Specified by:
trackScreenin interfaceAnalyticsProvider- Overrides:
trackScreenin classAbstractAnalyticsProvider
-
-
trackEvent
Description copied from interface:AnalyticsProviderRecords a named event.
Parameters
event: the event
- Specified by:
trackEventin interfaceAnalyticsProvider- Overrides:
trackEventin classAbstractAnalyticsProvider
-
setUserId
Description copied from interface:AnalyticsProviderAssociates subsequent activity with a user identifier.
Parameters
id: the user id, or null to clear
- Specified by:
setUserIdin interfaceAnalyticsProvider- Overrides:
setUserIdin classAbstractAnalyticsProvider
-
setUserProperty
Description copied from interface:AnalyticsProviderSets a user-level property / custom dimension.
Parameters
-
key: the property name -
value: the property value
- Specified by:
setUserPropertyin interfaceAnalyticsProvider- Overrides:
setUserPropertyin classAbstractAnalyticsProvider
-
-
reportCrash
Description copied from interface:AnalyticsProviderReports a crash or handled exception.
Parameters
report: the crash report
- Specified by:
reportCrashin interfaceAnalyticsProvider- Overrides:
reportCrashin classAbstractAnalyticsProvider
-
onConsentChanged
Description copied from interface:AnalyticsProviderNotifies the provider that the user's consent has changed so it can enable, disable or reconfigure collection accordingly.
Parameters
consent: the new consent state
- Specified by:
onConsentChangedin interfaceAnalyticsProvider- Overrides:
onConsentChangedin classAbstractAnalyticsProvider
-
flush
public void flush()Description copied from interface:AnalyticsProviderFlushes any buffered events to the backend.- Specified by:
flushin interfaceAnalyticsProvider- Overrides:
flushin classAbstractAnalyticsProvider
-
supports
Description copied from interface:AnalyticsProviderIndicates whether the provider supports a given capability.
Parameters
capability: the capability to query
Returns
true if supported
- Specified by:
supportsin interfaceAnalyticsProvider- Overrides:
supportsin classAbstractAnalyticsProvider
-