Uninstall Tracking through Firebase Cloud Messaging
Firebase Cloud Messaging (FCM) uninstall tracking detects app uninstalls by monitoring FCM delivery receipts. This method is ideal for React Native apps that already use push notifications.
How FCM Uninstall Tracking Works
- Purpose: Tracks app uninstalls using FCM delivery receipts to assess user engagement and campaign performance
- Mechanism: Uses FCM to send silent push notifications and monitors delivery receipts for failed deliveries
- Detection: Uninstall data typically appears in the panel within 24-48 hours
- Use Case: Measure uninstall rates for campaigns to refine targeting and improve user retention
For Firebase Analytics-based uninstall tracking, see Through Firebase Analytics.
Prerequisites
Before implementing FCM uninstall tracking, ensure you have:
- Firebase project with Cloud Messaging enabled
- React Native app with Firebase SDK integrated
- Trackier SDK properly initialized (version 2.0.0+)
- @react-native-firebase packages installed (version 23.5.0+)
- Android platform (FCM uninstall tracking is Android-only)
Implementation
1. Add Dependencies
Add Firebase packages to your project:
npm install @react-native-firebase/app @react-native-firebase/messaging
package.json:
{
"dependencies": {
"@react-native-firebase/app": "^23.5.0",
"@react-native-firebase/messaging": "^23.5.0",
"react-native-trackier-sdk": "^2.0.0"
}
}
Check the React Native Firebase documentation for the latest version and setup instructions.
2. Configure Firebase
Android Configuration
android/build.gradle:
buildscript {
dependencies {
classpath("com.google.gms:google-services:4.4.0")
}
}
android/app/build.gradle:
apply plugin: "com.google.gms.google-services"
Download google-services.json from Firebase Console and place it in android/app/ directory.
3. Initialize FCM
Create the FCM initialization function in your App.js:
FCM tokens are generated only once when the app is first installed or when Firebase generates a new token. If you run the app once and don't see the token in logs, you won't see it again on subsequent runs. To see the token again, you need to:
- Uninstall the app completely
- Reinstall the app
- Check logs immediately for the token
This is normal FCM behavior - tokens are not generated on every app launch, only when:
- App is first installed
- Firebase generates a new token (rare)
- App data is cleared
- App is restored on a new device
import React, { useEffect, useState, useRef } from 'react';
import { Platform } from 'react-native';
import { TrackierConfig, TrackierSDK } from 'react-native-trackier';
import messaging from '@react-native-firebase/messaging';
import { getApp, getApps } from '@react-native-firebase/app';
const App = () => {
// Initialize FCM - Android only, send token to Trackier on refresh
const initializeFCM = async () => {
if (Platform.OS !== 'android') {
return;
}
try {
const apps = getApps();
if (apps.length === 0) {
return;
}
const app = getApp();
const messagingInstance = messaging(app);
const authStatus = await messagingInstance.requestPermission();
const enabled =
authStatus === messaging.AuthorizationStatus.AUTHORIZED ||
authStatus === messaging.AuthorizationStatus.PROVISIONAL;
if (enabled) {
messagingInstance.onTokenRefresh((newToken) => {
console.log('FCM token refreshed:', newToken);
TrackierSDK.sendFcmToken(newToken);
});
}
} catch (error) {
console.log('Error initializing FCM:', error);
}
};
useEffect(() => {
const initializeSDK = async () => {
try {
const trackierConfig = new TrackierConfig(
'YOUR_SDK_KEY',
TrackierConfig.EnvironmentDevelopment
);
TrackierSDK.initialize(trackierConfig);
console.log('Trackier SDK initialized successfully');
// Initialize FCM after SDK initialization (important: SDK must be ready first)
// Only initialize on Android
if (Platform.OS === 'android') {
try {
await initializeFCM();
} catch (fcmError) {
console.log('Error initializing FCM:', fcmError);
}
}
} catch (error) {
console.error('Error initializing Trackier SDK:', error);
}
};
initializeSDK();
}, []);
return (
// Your app components
);
};
export default App;
- Token Generation: FCM tokens are generated when the app is first installed or when the token is refreshed
- Token Refresh: Tokens can change when:
- App is restored on a new device
- App data is cleared
- App is uninstalled and reinstalled
- Token expires (rare)
- One-Time Call: The
onTokenRefreshlistener is called only when a new token is generated, not on every app launch - SDK Integration:
TrackierSDK.sendFcmToken(newToken)sends the token to Trackier. This should only be called when the token is actually generated or refreshed, similar to Android'sonNewToken()method
4. Firebase Console Configuration
Step 1: Connect Product to Firebase
If you haven't already connected your product to Firebase:
- Go to the Firebase Console
- Create a new project or select an existing one
- Add your Android app to the project
- After setting up the project on console, go to Settings
- In the General tab, see the Project ID and copy it

Step 2: Configure in AppTrove Panel
- Go to your AppTrove panel
- Navigate to Settings page
- Go to Uninstall Tracking tab
- Paste the Project ID you copied from Firebase Console
- Enable the toggle for uninstall tracking

Step 3: Enable Cloud Messaging API
- Go to the Cloud Messaging tab
- Check if Firebase Cloud Messaging API (V1) is enabled

If not enabled:
- Go to Service accounts tab

- Go to Library
- Search for Firebase Cloud Messaging API
- Click Enable

Step 4: Create Custom Role for AppTrove
- In the side menu, select Roles
- Click +Create role

- Complete the form as follows:
- Title: Enter
AppTrove Uninstall - ID: Enter
at_uninstalls - Role launch stage: Select
General availability
- Title: Enter
- Click Add permissions

- In the Filter field, search for:
cloudmessaging.messages.create - Select the permission and click Add
- Click Create
After creating the role, check and verify that the AppTrove Uninstall role has been added successfully with the cloudmessaging.messages.create permission.

Step 5: Assign AppTrove the FCM Uninstall Role
- In the side menu, select IAM
- Click Grant Access

- In Add Principals → New principals, enter:
at-uninstalls-tracking-tra-430@trackier-mmp.iam.gserviceaccount.com - In Assign roles → Role select Custom and choose AppTrove Uninstall (the role we created earlier)
- Click Save
Use this exact email address: at-uninstalls-tracking-tra-430@trackier-mmp.iam.gserviceaccount.com

Step 6: Verify Permissions
- Go to IAM & Admin → IAM
- Search for the service account you just added
- Verify that the AppTrove Uninstall role is assigned

Verification and Testing
1. Test FCM Token Registration
When your app starts, check the logs to verify the FCM token is being sent to Trackier:
npx react-native run-android
Check the console logs for:
Trackier SDK initialized successfully
FCM token refreshed: [YOUR_FCM_TOKEN]
Check Token Response: Look for the log message Fcm token Api response saved successfully in Android Studio Logcat

Expected Log Output:
D/trackiersdk: Fcm token Api response saved successfully
2. Test Uninstall Detection
- Install your app and register FCM token
- Uninstall the app
- Wait 24-48 hours for the uninstall data to be processed
- Check AppTrove dashboard for uninstall event
3. Monitor AppTrove Dashboard
- Log in to your AppTrove dashboard
- Navigate to uninstall logs
- Confirm the uninstall event was received (typically within 24-48 hours)
Uninstall events are not detected immediately. It typically takes 24-48 hours for uninstall data to appear in the AppTrove panel after an app is uninstalled. This is normal behavior for FCM-based uninstall tracking.
Important Notes
- Token Generation: FCM tokens are generated when the app is first installed or when the token is refreshed
- Token Refresh: Tokens can change when:
- App is restored on a new device
- App data is cleared
- App is uninstalled and reinstalled
- Token expires (rare)
- One-Time Call: The
onTokenRefreshlistener is called only when a new token is generated, not on every app launch - SDK Integration:
TrackierSDK.sendFcmToken(newToken)sends the token to Trackier. This should only be called when the token is actually generated or refreshed, similar to Android'sonNewToken()method
AppTrove uses silent push notifications solely to measure uninstalls or identify inactive users and does not use them for any other purposes. These notifications are invisible to users and don't affect app performance.
Troubleshooting
Common Issues
- FCM token not received: Ensure Firebase is properly configured with
google-services.jsoninandroid/app/directory and@react-native-firebasepackages are installed - Uninstall not detected: Check server logs for FCM delivery failures and verify token registration
- Token not sent to Trackier: Ensure
initializeFCM()is called after SDK initialization - Rate limiting: Implement proper delays between FCM sends to avoid Google's rate limits
- Token expiration: The
onTokenRefreshlistener automatically handles token updates - Permission denied: Verify push notification permission is granted
Best Practices
- Silent notifications: Use silent push notifications to avoid user disruption
- Rate limiting: Implement proper delays to avoid FCM rate limits
- Token management: Handle FCM token refresh and updates properly
- Error handling: Implement comprehensive error handling for FCM failures
- Security: Store FCM tokens securely on your server
- Call Order: Always initialize FCM after Trackier SDK initialization
Debug Steps
-
Verify Firebase Setup:
cd android && ./gradlew signingReport
cd .. && npx react-native run-android -
Check Logs:
npx react-native log-android
# or
adb logcat -s trackiersdk -
Verify Dependencies: Ensure both
@react-native-firebase/appand@react-native-firebase/messagingare properly installed -
Check Firebase Console: Verify your app is registered and FCM API is enabled
-
Test Token Listener: Add debug prints to verify the
onTokenRefreshlistener is active:messagingInstance.onTokenRefresh((newToken) => {
console.log('DEBUG: FCM Token received:', newToken);
TrackierSDK.sendFcmToken(newToken);
}); -
Verify Platform: Ensure you're testing on Android device/emulator, as iOS doesn't support FCM uninstall tracking
For additional help, contact AppTrove support or refer to the React Native Firebase Documentation.