Skip to main content
Version: SDK 5.0.x

Integrate with Firebase

If you are using the Firebase SDK next to the justtrack SDK, you can use the justtrack SDK to send the Firebase app instance ID of a user to the justtrack backend. You can then later send events from the justtrack backend to Firebase to measure events happening outside of your app. To send these events, the justtrack backend needs the Firebase App instance ID of the user. You can send this by calling sdk.setFirebaseAppInstanceId(firebaseAppInstanceId). Or you could use sdk.integrateWithFirebase(), this will automatically fetch the Firebase App Instance ID.

If you prefer to enable the integration on SDK initialization step, you can also use these method in our builder builder.setFirebaseAppInstanceId(firebaseAppInstanceId) and setEnableFirebaseIntegration(enableFirebaseIntegration).

// Using builder.
sdk = new JustTrackSdkBuilder(this, BuildConfig.JUSTTRACK_SDK_API_TOKEN)
.setFirebaseAppInstanceId("firebaseAppInstanceId")
//or
.setEnableFirebaseIntegration(true)
.build();

// Or after SDK initialization.
Future<Boolean> result = sdk.setFirebaseAppInstanceId("firebaseAppInstanceId");
Future<Boolean> result = sdk.integrateWithFirebase();