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.
Modify the AndroidManifest.xml and integrate firebase cloud massaging service. FCM setup guidelines are here. Below is a code snippet:
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
}
}
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.
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.