AdGyde Logo

Uninstall Tracking


AdGyde's Uninstall Tracking functionality allows you to track the number of uninstalls for a specified application. Uninstalls is an important index which helps you to track the quality of users and hence the campaign.

1. Requirements
An Android application with AdGyde SDK integrated. Also, Firebase Project's Server Key for the same application

Notes:-
  1. Uninstalls tracking is supported from Android SDK version 3.1.0
  2. If you are using multiple InstanceIDListener services, you can create your own Listener and pass the token to AdGyde's API


2. Steps to Enable AdGyde's Uninstall Tracking

2.1. Application Without Firebase Messaging
If your android application is not using Firebase Messaging Service, then follow below instructions:

  • Get your Firebase project's Server Key (Section 3)
  • Enter the Server Key to your AdGyde's dashboard. (Section 4)
  • Configure Firebase Messaging on your app. (Section 5)
  • Add the following code to your application as described:
  • Add the Firebase Dependency to your app's build.gradle file, as the following:

    dependencies {
    // . . .
    implement 'com.google.firebase:firebase-messaging:19.0.1'
    // . . .
    }

  • Add these lines to your app's AndroidManifest.xml file, inside the application tag:

    <application
    <!-- ... -->
    <service android:name="com.adgyde.android.FIIDService" exported="false" >
    <intent-filter>
    <action android:name="com.google.firebase.MESSAGING_EVENT"/>
    </intent-filter>
    </service>
    <!-- ... -->
    </application>

2.2. Application with Firebase Messaging Integrated
If you have Firebase Notifications integrated into your app, then follow these instructions:

  • Obtain your Firebase project's Server Key. (Section 3)
  • Enter the Server Key to your AdGyde dashboard. (Section 4)
  • Add the following code to your application as described:
  • In your InstanceIDListener Service's onTokenRefresh method (a class extending com.google.firebase.iid.FirebaseInstanceIdService), call our API inside the overridden method onTokenRefresh, as in the following example:

public class FIIDService extends FirebaseMessagingService {
private static final String TAG = "FIIDService";
@Override
public void onNewToken(String token) {
super.onNewToken(token);
try {
String refreshedToken = token;
if (!TextUtils.isEmpty(refreshedToken)){
AdGyde.onTokenRefresh(refreshedToken);
Log.d(TAG, "onTokenRefresh Refreshed token : " + refreshedToken);
}
} catch(Exception e){
e.printStackTrace();
}
}
}

3. Obtaining the Firebase Server Key
  1. Open the Firebase Console: https://console.firebase.google.com
  2. Create a Firebase Android Application project (if you have not already done so). For more information, visit this link: https://firebase.google.com/docs/notifications/android/console-audience#add_firebase_to_your_app
  3. After the project is created, open the project page by selecting the project from all the listed projects
  4. Navigate to the Project Settings (click on the cogwheel next to Overview on the left pane of the page)
  5. Under the Cloud Messaging tab, you can see your Sender ID which you may be using for FCM / GCM) and two Server Keys as shown below



  6. Make Note of Server Key (The Long Key and not the Legacy Server Key), which will be input in AdGyde's dashboard for uninstall tracking

4. Entering the Server Key on AdGyde's Dashboard
  1. Login to AdGyde Dashboard
  2. Click on Setup -> Uninstall left navigation menu.

  3. Input the Firebase Server Key, which you had copied / noted in previous section in the area provided


5. Configure Firebase-Messaging on your Application
Follow the below steps as listed, or alternatively visit the firebase integration link by Google
https://firebase.google.com/docs/cloud-messaging/android/client

  1. Download your project's JSON file: google-services.json and saved it under your application's module directory. If you do not have this file, you can download it from your Project Settings in the Firebase Console
  2. Add the Firebase-Messaging dependencies to your project. Add rules to your root-level build.gradle file to include the google-services plugin:

    buildscript {
    // ...
    dependencies {
    // ...
    classpath 'com.google.gms:google-services:4.3.0'
    // ADD THIS LINE HERE
    }
    }

  3. In module Gradle file (usually the app/build.gradle) of the project, add the apply plugin line at the bottom of the file to enable the Gradle plugin, and add also the dependency inside the dependencies block

    apply plugin: 'com.android.app'
    android {
    // ...
    }

    dependencies {
    // ...
    compile 'com.google.firebase:firebase-messaging:19.0.1'
    // ADD THIS LINE AT THE BOTTOM OF THIS BLOCK
    }
    .
    .
    .
    apply plugin: 'com.google.gms.google-services'
    // ADD THIS LINE AT THE BOTTOM OF THIS FILE

    In case "Could not find.." error is encountered, make sure you have the latest Google Repository in the Android SDK Manager to resolve the same

6. Using ProGaurd with Uninstall Tracking
If your project is using ProGaurd, you need to take care that AdGyde SDK functions and Google Firebase Messaging Service functions do not get obfuscated, for same following rule exceptions need to be added in ProGaurd file

-dontwarncom.adgyde.android.**
-keep public class com.google.firebase.iid.FirebaseInstanceId {
public *;
}


7. Testing Android Uninstall Tracking
Testing of uninstall tracking is quite simple.
Whether the android application is live on Google Play or pending submission or even if out of store, the test will remain the same - just uninstall the app from the device.

It takes up to 24 hours for the new app’s uninstall event to be displayed on the uninstall trends section of the Dashboard.



This website uses cookies in order to improve your experience and our services. By continuing to use our website, agree to the use of such cookies. Click here for Privacy Policy.