mFilterIt Uninstall Tracking

This guide details the steps to integrate the MFilterIt Uninstall tracking into an Android App.

Getting Started

Integrating the mFilterIt Uninstall Tracking solution into an app includes SDK integration and sharing FCM details with the SDK, and mFilterIt backend.

Uninstall Tracking Integration

The integration of this feature can be done by following below steps:

Step 1 : Integrate the mFilterIt Android SDK and share the FCM token to the SDK.

Step 2 : In order integrate FCM into a project the below steps have to be taken.

  1. Modify the AndroidManifest.xml and integrate firebase cloud massaging service. FCM setup guidelines are here. Below is a code snippet:

<!--firebase cloud messaging tags start-->
<service android:name=".MyFirebaseMessagingService">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
</service>
<meta-data
    android:name="firebase_analytics_collection_enabled"
    android:value="false" />
<!--firebase cloud messaging tags end-->

2. Add following dependencies in build.gradle for app module:

compile 'com.google.firebase:firebase-core:16.0.5'
compile 'com.google.firebase:firebase-messaging:17.3.4'

3. Add plugin for google-services in build.gradle for app module:

apply plugin: 'com.google.gms.google-services'

4. Add google services dependencies in project build.gradle file:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
   classpath 'com.google.gms:google-services:4.0.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

}

Step 3 : Pass FCM token using this method:

MFilterIt.sendEvent(Context context, String vendorId,String eventArray,String eventType);

Parameter

Description

context

Context object returned by getApplicationContext

vendorId

This is a unique Vendor ID string allocated to the app developer.

eventArray

A JSON string that captures the array of events to be sent.

For example the below string sends two events called event1 and event2, with values value1 and value2

"{ 'event1' : 'value1' , 'event2' : 'value2'}" One of the keys in the event should be FCM_TOKEN , which contains, fcm token generated by device running application.

eventType

This should be a hardcoded value passed as "UninstallEvent", for uninstall tracking.

The below is a code snippet of how the sendEvent API is invoked:

package com.mfilterit.demoapp;

import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import com.mfilterit.MFilterIt;


public class MyFirebaseMessagingService extends FirebaseMessagingService {


    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        try{
        if (remoteMessage.getData().size() > 0) {
            Log.d("data:",remoteMessage.getData().toString());


        }
        }catch (Exception e){
            Log.d("error_term1");
        }
    }

    public void onNewToken(String s) {
    
        try{
    
    
            MFilterIt.sendEvent(this, "vendorId",s,"UninstallEvent");
    
        }
    catch (Exception e ){
            Log.d("error_term2");
        }
    }
}

Step 4 : The below import statement needs to be added to the corresponding files (if needed).

import com.mfilterit.MFilterIt;

Points to remember : In order for the mFilterIt System to track the uninstalls, the Server Key and Sender Id need to be configured in the mFilterIt Dashboard.

Last updated