Firebase / ANDROID
Firebase
Set up Analytics and Crashlytics with initialization, event and error methods, and explicit collection controls.
Before you start
- A Firebase app whose application ID and google-services.json match the selected build variant.
- Google Services and Crashlytics Gradle plugin declarations, plus BoM-aligned SDK dependencies.
- Application-owned collection defaults and stored consent/settings choices.
Connect the component
Connect the Firebase project
Register the Android application in Firebase and supply the matching google-services.json. Keep existing root or catalog declarations as the single owner of plugin versions.
Inspect generated setup
Choose Firebase and review the component, Application example and dependency guide. The current template covers Analytics and Crashlytics.
Merge initialization
Initialize from your existing Application class, preserving its superclass and other setup. Apply persisted collection choices through the component. A generated Application example is not registered automatically.
Validate collection behavior
If collection must remain off until a choice is known, configure Manifest defaults before Firebase auto-initializes. Test intentional events and handled errors, then confirm the expected data reaches the appropriate Firebase tools.
What initialization looks like
These excerpts use the generated component’s public methods. Import your component and merge the calls into the lifecycle and callbacks shown in its generated guide.
// Merge into your existing Application.onCreate().
val firebase = FirebaseServices.initialize(this)
// Use your app's persisted collection choices.
firebase.applyCollectionSettings(
analyticsEnabled = analyticsChoice,
crashReportsEnabled = crashReportingChoice
)
firebase.logEvent("tutorial_complete")
// Set collection defaults before Firebase auto-initializes.// Merge into your existing Application.onCreate().
FirebaseServices firebase = FirebaseServices.initialize(this);
// Use your app's persisted collection choices.
firebase.applyCollectionSettings(
analyticsChoice,
crashReportingChoice);
firebase.logEvent("tutorial_complete", new Bundle());
// Set collection defaults before Firebase auto-initializes.INTEGRATION NOTES
- Adding a component does not implement consent or guarantee that SDK collection is disabled.
- The pinned setup guide calls out API 24+ and separate Crashlytics build-plugin prerequisites.
- FCM, Remote Config, Performance and Firebase account management are not included in this release.
Keep the official references close.
GooglePlay API maintains the component template. The SDK behavior and service requirements are defined by the provider.