Android uninstall tracking utilizes Firebase Cloud Messaging services. Firebase is deprecating the legacy HTTP API on July 22, 2024. If you are still using the legacy HTTP API, update to use the HTTP V1 API via the Singular app configuration page. Learn more.
Singular gives you the option of tracking app uninstalls, as another way to measure the quality of traffic you get through your marketing campaigns. The ability is available in the Singular Android SDK version 7.x+ and enabling it requires an app update.
Notes:
- Singular's uninstall tracking takes advantage of Google services but uses a different methodology from Google. Google reports uninstalls directly from the operating system on the device. As a result, the numbers reported by Google may differ from the ones reported by Singular.
- Uninstalls are tracked as events in Singular and as a result do not remove the attribution link from the originating Install or Re-engagement source. This may result in uninstall rates of higher than 100%, since a user may uninstall an app multiple times in their lifetime.
If Domain Restricted Sharing is enabled for your Google Organization, apply the Singular Organization ID to Allowed Values:
- Access Organization Policies
- In the Google Cloud Console, navigate to the Organization policies page.
- Select the organization resource where you want to set the policy.
- Find and select the Domain Restricted Sharing constraint from the list.
- Click Manage policy.
Add Organization ID to Allowed Values
- Under Policy values, choose Custom.
- Enter your organization resource ID in the format:
is:principalSet://iam.googleapis.com/organizations/626787461583
Setup Instructions
- Integrate Android SDK 7.x+: Uninstall tracking is available in Android SDK version 7.x and above. For instructions on upgrading your SDK, review our Android SDK integration guide.
- Modify AndroidManifest.xml: See the Android SDK uninstall tracking guide details.
- In the Singular Apps page > App > Advanced Settings > Uninstall Tracking, enter in the Project ID.
To create and configure your Project ID
- Go to the Firebase Cloud Messenger Console
- Select or create a new project
- Navigate to Project Overview > Project Settings, and copy your Project ID. This is the Project ID which you will need to enter in your Singular apps page after the project has been granted the proper roles and permissions in the subsequent steps.
- Enable FCM Cloud Messaging for the project by navigating to Cloud Messaging and enabling Firebase Cloud Messaging API (V1)
- Navigate to Service Accounts > Manage service account permissions
- Assign the correct project role and permissions
- Select Roles in the left navigation menu
- Click Create Role and enter the following information
Title: Singular Uninstall Tracking
ID: singular_uninstalls
Role launch stage: General Availability - Click Add Permissions and add cloudmessaging.messages.create. You can find this quickly by Filtering on Firebase Cloud Messaging API Admin.
- Click Create to finish creating the role
-
Assign Singular to the role
- Select IAM in the left navigation menu
- In the Permissions tab, click Grant Access
- Under Add principals > New principals, type in:
singular-uninstall-tracking@singular-uninstall-tracking.iam.gserviceaccount.com
- Under Assign roles, select the "Singular Uninstall Tracking" created in the prior steps
The final configuration should match:
- Click Save
To set up uninstall tracking in Android:
- Integrate Android SDK 7.x+: Uninstall tracking is available in Android SDK version 7.x and above. For instructions on upgrading your SDK, review our Android SDK integration guide.
- Modify AndroidManifest.xml: See the Android SDK uninstall tracking guide details.
-
Add your Sender ID and Server Key: Singular requires a Google Project Number and Server Key for enabling uninstall tracking. To retrieve these values:
- In Firebase, select Go to Console and select the project.
-
Select the gear icon and go to Project Settings > Cloud Messaging.
- In your Singular account, go to Settings > Apps, find the app for which you want to track uninstalls, and select Edit.
-
Under Uninstall Tracking, add the Project Number (Sender ID on Firebase) and Server Key.
-
Configure FCM in your app as follows:
- In the Firebase console, create a Firebase project.
- In the project dashboard, select Add Firebase to your Android App.
-
Enter the Android app's package ID.
- Download the config file (google-services.json) and copy it into the app module of the Android project.
- In the project-level build.gradle file (><project>/build.gradle>), add the following:
buildscript {
dependencies {
// Add this line or latest version
classpath 'com.google.gms:google-services:3.1.0'
}
} - In the app-level build.gradle file (><project>/<app-module>/build.gradle>), add the following:
// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services' - Sync the project.
- In the Android code, create the following service:
The onTokenRefresh method gets an FCM token that is needed in order to send notifications.public class FCMService extends FirebaseInstanceIdService {
@Override
public void onTokenRefresh() {
super.onTokenRefresh();
//now we will have the token
String token = FirebaseInstanceId.getInstance().getToken();
}
} - Add the service to the Android manifest file:
<service android:name=".FCMService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/
</intent-filter>
</service>
Singular will now track uninstalls for users who have the updated version of your application.
Testing the Notification
You can test the notification using the console by providing an FCM token: