Class FirebaseAnalyticsProvider
- All Implemented Interfaces:
AnalyticsProvider
A provider that forwards analytics to the native Firebase Analytics
SDK through the NativeFirebaseAnalytics native interface. On
Android and iOS, with Firebase configured in the build, events flow
to the Firebase console. Where no native peer exists (the simulator,
or a build without Firebase set up) the provider degrades silently to
a no-op, so it is always safe to register.
Analytics.addProvider(new FirebaseAnalyticsProvider());
Firebase requires the usual platform configuration:
google-services.json (Android) / GoogleService-Info.plist (iOS)
plus the Firebase dependencies in the generated native project.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetName()A short, stable, human readable name for this provider (used in logs and diagnostics).voidinit(AnalyticsContext context) Called once when the provider is registered with the facade, supplying ambient application context.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
flush, getContext, onConsentChanged
-
Constructor Details
-
FirebaseAnalyticsProvider
public FirebaseAnalyticsProvider()
-
-
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
-
init
Description copied from interface:AnalyticsProviderCalled once when the provider is registered with the facade, supplying ambient application context.
Parameters
context: the analytics context
- Specified by:
initin interfaceAnalyticsProvider- Overrides:
initin classAbstractAnalyticsProvider
-
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
-
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
-