Setting Up Android Uninstall Tracking

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.

Setup Instructions

To set up uninstall tracking in Android:

  1. 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.
  2. Modify AndroidManifest.xml: See the Android SDK uninstall tracking guide details.
  3. 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.

      Screen_Shot_2017-12-27_at_4.48.09_PM.png

    • 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.

      Screen_Shot_2017-12-27_at_4.56.56_PM.png

  4. Configure FCM in your app as follows:

    1. In the Firebase console, create a Firebase project.
    2. In the project dashboard, select Add Firebase to your Android App.
    3. Enter the Android app's package ID.

      Screen_Shot_2017-12-27_at_4.55.41_PM.png

    4. Download the config file (google-services.json) and copy it into the app module of the Android project.
    5. 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'
      }
      }
    6. 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'
    7. Sync the project.
    8. In the Android code, create the following service:
      public class FCMService extends FirebaseInstanceIdService {
      @Override
      public void onTokenRefresh() {
      super.onTokenRefresh();
      //now we will have the token
      String token = FirebaseInstanceId.getInstance().getToken();
      }
      }
      The onTokenRefresh method gets an FCM token that is needed in order to send notifications.
    9. 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:

Screen_Shot_2017-12-27_at_4.56.12_PM.png