Introduction Last updated: 2021-07-22

The Clevertap Assistant Plugin was developed specifically as a helping tool for developers to assist them in integrating Clevertap seamlessly into their android appliactions. Basic Integration and functionalities such as push notifications, geofence etc can be coded inside your application with few clicks and the plugin takes care of the code insertion automaticaly.

The plugin can function seamlessly on both java or kotlin and depending up on the language you have chooses it will adapt itself automatically

Installation

The CleverTap Assistant Plugin can be set up either by manually installng the plugin files into your android studio or you can directly download it from the Android Sudio Plugin Marketplace. Follow the steps below to install the plugin :

Manual Installation

You can download the plugin files from the Android Studio Plugin Market Place or ask your customer success manager for an updated version. Follow the steps to manually install the plugin :

  1. Process begins with downloading the plugin .zip file into your machine. Then open android Studio and navigate to plugins through any of these steps.

    Android Studio > Configure > Plugin.   View

    Android Studio > Open Project > Tools(Menubar) > SDK Manager > Plugin.   View

    Android Studio > Open Project > Search Icon > Plugin.   View

  2. Click on the settings icon and select install from disk option.


  3. Browse to the location where you saved the .zip file and select it.This should show the Clevertap Assistant Plugin Enabled, click Okay and apply the changes to activate the plugin.


Android Marketplace

This option provides a single click download and install option into your android studio and you can begin use instantly.

Navigate to plugins in android studio and search for CleverTap Assistant in the Market Place tab.


Note

Sometimes the Android Studio IDE might require a restart for the plugin changes to apply.

Basic Integration

This section helps you to integrate the CleverTap SDK to track your users, events etc and see this information within the Clevertap dashboard. To track, segment, and engage your users complete basic integration as follows :

File > New > Clevertap Assistant > Basic Integration.   View


Details and values.

  • Account ID / Token : To associate your Android app with your CleverTap account, you need to add your CleverTap credentials such as the account id and account token.These values are available on the Settings page at the bottom left-hand corner of your dashboard.

    Dashboard > Settings > Copy Values

  • Google Ad ID : Select Yes to use Google's advertising ID as Clertap ID.

  • Using Google AD ID to uniquely identify users

    GDPR mandates that if you are using Google AD ID to uniquely identify users, there should be prominent disclosure in your application that explains this to your end customer. For more information, refer to this GDPR article.

    Note: If you still want to use Google AD ID to generate a user's identity, so that you can identify users across re-installs, add the meta tag that forces the use of the Google AD ID to generate an identity in CleverTap.

  • Clevertap region : By default, we process and store customer data in our EU data center. For CleverTap customers based in India or any other region who need in-region storage and processing for regulatory compliance, we offer U.S, India, Singapore & South Korea as a data center.

  • IN-App Exclude : In-app notifications are pop-ups that you can show to your users while they are in your application.Mention the activities on which you do not want in-app notifications to show.

  • Application Class : The application class ensure that system events such as app launch, install , uninstall etc are captured automatically by the clevertap SDK.

Affected Files.

<!-- Required to allow the app to send events and user profile information -->
<uses-permission android:name="android.permission.INTERNET"/>
<!-- Recommended so that CleverTap knows when to attempt a network call -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<!-- CleverTap Credentials -->
<meta-data
android:name="CLEVERTAP_ACCOUNT_ID"
android:value="Your CleverTap Account ID"/>
<meta-data
android:name="CLEVERTAP_TOKEN"
android:value="Your CleverTap Account Token"/>
<meta-data
android:name="CLEVERTAP_USE_GOOGLE_AD_ID"
android:value="1"/>

implementation 'com.clevertap.android:clevertap-android-sdk:4.0.2'

//Java
CleverTapAPI clevertapDefaultInstance = CleverTapAPI.getDefaultInstance(getApplicationContext());

//Kotlin
var cleverTapDefaultInstance: CleverTapAPI? = null
cleverTapDefaultInstance = CleverTapAPI.getDefaultInstance(applicationContext)

Events and User Properties

The Clevertap Assistant Plugin also provides some utilities to fast pace the integration of clevertap into you project by providing one click code snippet insertions.

To access these utilities point your cursor anywhere in the file where you want to insert the code snippet and right click to view the options available.


Initialize Clevertap

Adds a clevertap object initialization code snippet at cursor point.
Snippet :


CleverTapAPI clevertapDefaultInstance = CleverTapAPI.getDefaultInstance(getApplicationContext());


var clevertapDefaultInstance: CleverTapAPI? = null
clevertapDefaultInstance = CleverTapAPI.getDefaultInstance(applicationContext)//added by CleverTap Assistant

Add User Properties

After you integrate our SDK, CleverTap creates a user profile for each person who launches your app or visits your website. A CleverTap user profile has a set of default fields, such as email, phone number, and language. You can also extend the default user profile by adding custom fields that are specific to your business.
you can use the "onUserLogin" method to assign unique profile to track each user account separately. When initially installed on a device, your app is assigned an anonymous profile. You can use the "profile.push" method to add more user properties to the identified profiles.

You can add the "onUserLogin" code snippet in your login page files and the "profile.push" code snippet onto your update profile pages.

Code Snippet for onUserLogin :


HashMap OnUserLoginProperties = new HashMap();
OnUserLoginProperties.put("USer Property_name ", "value");
clevertapDefaultInstance.onUserLogin(OnUserLoginProperties);//added by CleverTap Assistant


val OnUserLoginProperties =HashMap()
OnUserLoginProperties["USer Property_name "]="value"
clevertapDefaultInstance?.onUserLogin(OnUserLoginProperties) //added by CleverTap Assistant


Code snippet for Profile push :


HashMap ProfilePush = new HashMap();
ProfilePush.put("USer Property_name ", "value");
clevertapDefaultInstance.pushProfile(ProfilePush);//added by CleverTap Assistant


val ProfilePush =HashMap()
ProfilePush["USer Property_name"]= "value"
clevertapDefaultInstance?.pushProfile(ProfilePush)//added by CleverTap Assistant

Add Custom Events

Once you integrate the CleverTap SDK, we automatically start tracking events, such as App Launch and Notification Viewed. In addition to the default events tracked by CleverTap, you can also track custom events.
To send custom events to CleverTap using our Android SDK, you have to call the pushEvent method with the name of the custom event you want to track.

You can add an individual event or event with various properties at a selected cursor point.
Code Snippet :


HashMap eventProperties = new HashMap();
eventProperties.put("Event Property_name ", "value");
clevertapDefaultInstance.pushEvent("event_name", eventProperties);//added by CleverTap Assistant


val eventProperties =HashMap()
eventProperties["USer Property_name "]="value"
clevertapDefaultInstance?.pushEvent("event_name", eventProperties) //added by CleverTap Assistant

Push Notifications

Handle all different kinds push notification from various developer services like Firebase, Huawei and Xiaomi Push through Clevertap.

Push Integration

The easiest way to send push notifications is to use the default implementation by CleverTap, however, if you have your own implementation you can implement scenaio 1.

File > New > Clevertap Assistant > Push Notification.   View

Scenario 1 : 'Yes' is Selected


Scenario 2 : 'No' is Selected


Details and Values

  1. Push Notification implementation : Select yes if you have already implemented push notification using firebase cloud messaging, if not then select "No" to configure using the plugin.

  2. FCM Service Name : Name of the Firebase Service class to be created to handle incoming push notifications.

  3. Channel Id : All push notification must be passed through a notification channel starting with Android O and later versions.

  4. FCM Sender Id : Refer note below.

  5. Dependency Version : Firebase messaging dependency version to be used in the projrct

  6. Google Service File : Refer note below.

Affected Files


For Scenario 1 :


<receiver
  android:name="com.clevertap.android.sdk.pushnotification.CTPushNotificationReceiver"
  android:exported="false"
  android:enabled="true">
</receiver>


import android.app.NotificationManager;
CleverTapAPI.createNotificationChannel(getApplicationContext(),"YourChannelId","Your Channel Name","Your Channel Description",NotificationManager.IMPORTANCE_MAX,true);


import android.app.NotificationManager
CleverTapAPI.createNotificationChannel(getApplicationContext(),"YourChannelId","Your Channel Name","Your Channel Description",NotificationManager.IMPORTANCE_MAX,true);

public class MyFcmMessageListenerService extends FirebaseMessagingService {

  @Override
  public void onMessageReceived(RemoteMessage message){
   try {
    if (message.getData().size() > 0) {
     Bundle extras = new Bundle();
     for (Map.Entry<String, String> entry : message.getData().entrySet()) {
      extras.putString(entry.getKey(), entry.getValue());
     }

     NotificationInfo info = CleverTapAPI.getNotificationInfo(extras);

     if (info.fromCleverTap) {
      CleverTapAPI.createNotification(getApplicationContext(), extras);
     } else {
      // not from CleverTap handle yourself or pass to another provider
     }
    }
   } catch (Throwable t) {
    Log.d("MYFCMLIST", "Error parsing FCM message", t);
   }
  }

@Override
Public void onNewToken(@NonNull String s)
{
  super.onNewToken(s);
  cleverTapDefaultInstance=CleverTapAPI.getDefaultInstance(getApplicationContext());
  cleverTapDefaultInstance.pushFcmRegistrationId(s,true);
}
}


class MyFcmMessageListenerService : FirebaseMessagingService() {

  override fun onMessageReceived(message: RemoteMessage) {
   message.data.apply {
    try {
     if (size > 0) {
      val extras = Bundle()
       for ((key, value) in this) {
        extras.putString(key, value)
       }
       val info = CleverTapAPI.getNotificationInfo(extras)
       if (info.fromCleverTap) {
        CleverTapAPI.createNotification(applicationContext, extras)
       } else {
        // not from CleverTap handle yourself or pass to another provider
       }
      }
     } catch (t: Throwable) {
      Log.d("MYFCMLIST", "Error parsing FCM message", t)
     }
    }
    }
   }
 

For Scenario 2 :

<receiver
  android:name="com.clevertap.android.sdk.pushnotification.CTPushNotificationReceiver"
  android:exported="false"
  android:enabled="true">
</receiver>

<service
android:name=".fcm.FcmMessageListenerService">
  <intent-filter>
   <action android:name="com.google.firebase.MESSAGING_EVENT"/>
  </intent-filter>
</service>

<meta-data
  android:name="FCM_SENDER_ID"
  android:value="id:(insert your value)"/>

dependencies {
  implementation 'com.google.firebase:firebase-messaging:20.2.4'
  implementation 'androidx.core:core:1.3.0'
   //Mandatory for CleverTap Android SDK v3.6.4 and above add the following -
   implementation 'com.android.installreferrer:installreferrer:2.1'
  }
// at the end of the build.gradle file
apply plugin: 'com.google.gms.google-services'


Classpath ‘com.google.gms:google-services:4.3.3’


CleverTapAPI.createNotificationChannel(getApplicationContext(),"YourChannelId","Your Channel Name","Your Channel Description",NotificationManager.IMPORTANCE_MAX,true);


CleverTapAPI.createNotificationChannel(getApplicationContext(),"YourChannelId","Your Channel Name","Your Channel Description",NotificationManager.IMPORTANCE_MAX,true);

Dashboard Settings

You need to enable Push Notifications on the dashboard and update credentials from your firebase project. Follow these steps to enable push notifications:

  1. Navigate to Settings > Channel > Mobile Push.
  2. Enter the credentials.


Note :

Firebase Sender ID and Server API key both are a part of your project on firebase. You can obtain them from Project Console > Project Settings > Cloud Messaging.   View

The GoogleServices.JSON file is also a part of your firebase project and it contains certain credentials and configuration settings which is needed to verify while connecting to the GoogleApiClient. You can obtain it from Project Console > Project Settings > General.   View

Xiaomi Push Integration

CleverTap can send push notifications powered by Xiaomi Cloud Push, an Android push notification delivery service for Chinese devices. For a greater chance of delivery success, we send a push notification through both Xiaomi Cloud Push and Firebase Cloud Messaging (FCM) push services.The first step to access the Xiaomi cloud push is registered as a Xiaomi developer on the Xiaomi Website.Then you can configure your project using the clevertap plugin for xiaomi push by these steps :

File > New > Clevertap Assistant > Xiaomi Push.   View


Deatils and Values

  1. Xiaomi App ID : Unique Id for a project/ client's identity available on the xiaomi developer console.

  2. Xiaomi App Key : Also a part of client’s identity available on the xiaomi developer console.

Affected Files


<meta-data
  android:name="CLEVERTAP_XIAOMI_APP_KEY"
  android:value="@string/xiaomi_app_key" />

<meta-data
  android:name="CLEVERTAP_XIAOMI_APP_ID"
  android:value="@string/xiaomi_app_id" />


<string name="xiaomi_app_key">Your Xiaomi App Key</string>
<string name="xiaomi_app_id">Your Xiaomi App ID</string>


implementation 'com.clevertap.android:clevertap-xiaomi-sdk:1.0.2'

Dashboard Setting

You need to enable Xiaomi Push Notifications on the dashboard and update credentials from your Xiaomi Developer Console Project. Follow these steps to enable push notifications:

  1. Navigate to Settings > Channel > Mobile Push.
  2. Enter the credentials.


Note :

Once the App is created on your console, click on the App name to get your Package Name/App ID/ App Key/ App Secret. Among these, the AppID and AppKey are the client’s identity, used when the client SDK initializes; the AppSecret is authenticated for sending a message at the server-side.   View

Huawei Push Integration

Huawei uses its own push service to deliver notifications to their devices.CleverTap can send push notifications powered by Huawei Cloud Push, an Android push notification delivery service. For a greater chance of delivery success, we send a push notification through both Huawei Cloud Push and Firebase Cloud Messaging push services. If a message is delivered through one of these push services, the notification from the other cloud service is suppressed. This ensures that the user will only receive the push notification once.To configure your project for Huawei Push using the clevertap plugin follow these steps :

File > New > Clevertap Assistant > Huawei Push.   View


Deatils and Values

  1. The first step to access the Huawei cloud push is registered as a Huawei developer on the Huawei Website.

  2. Once you login to the console, enable the Push Kit. Enable other settings as mentioned by Huawei.

  3. Agconnect-Service File : The agconnect-services. json file provides configuration information required by various services in your AppGalleryConnect project. Download the agconnect-services.json file from the Huawei Console.

Affected Files


implementation 'com.clevertap.android:clevertap-hms-sdk:1.0.1'
implementation 'com.huawei.hms:push:5.0.0.300'//Add the dependency

apply plugin: 'com.huawei.agconnect'//Add This at the bottom of the file


buildscript {
  repositories {
   // HUAWEI ADD THIS
   maven {url 'http://developer.huawei.com/repo/'}
  }
  dependencies {
   classpath "com.android.tools.build:gradle:4.0.1"

   // HUAWEI ADD THIS
   classpath 'com.huawei.agconnect:agcp:1.3.1.300'
  }
}

allprojects {
  repositories {
   // HUAWEI ADD THIS
   maven {url 'http://developer.huawei.com/repo/'}
  }
}

Dashboard setting

You need to enable Huawei Push Notifications on the dashboard and update credentials from your Huawei Developer Console Project. Follow these steps to enable push notifications:

  1. Navigate to Settings > Channel > Mobile Push > Huawei Credentials.
  2. Enter the credentials.


Note :

  • Once the App is created on your console, click on the App name to get your Package Name/App ID/ App Key/ App Secret. Among these, the AppID and AppKey are the client’s identity, used when the client SDK initializes; the AppSecret is authenticated for sending a message at the server-side.   View
  • To test huawei integration in non huawei phone you would need to download the Huawei Mobile Services app on the Google Play

Push Amplification

Push amplification provides the capability to reach users on devices that suppress notifications via GCM/FCM.To allow your app to use CleverTap's push amplification via background ping service, use the Push Amplification feature from the Clevetap Assistant :

File > New > Clevertap Assistant > Push Amplification.   View


Affected Files

Scenario 1 : 'Yes' is Selected.


public class MyApplication extends Application implements CTPushAmpListener {
  @Override
  public void onCreate() {
   CleverTapAPI cleverTapAPI = CleverTapAPI.getDefaultInstance(getApplicationContext());
   cleverTapAPI.setCTPushAmpListener(this);
   super.onCreate();

  }
  @Override
  public void onPushAmpPayloadReceived(Bundle bundle) {
   //write push notification rendering logic here
  }
}
class MyApplication:Application(), CTPushAmpListener{
  override fun onCreate(){
   val cleverTapAPI = CleverTapAPI.getDefaultInstance(getApplicationContext())
   cleverTapAPI.setCTPushAmpListener(this)
   super.onCreate()
  }
  fun onPushAmpPayloadReceived(bundle:Bundle) {
   //write push notification rendering logic here
  }
  }
 
\\This code snippet is added inside the onMessageReceived() method of FCM Receiver Class

if (message.getData().size() > 0) {
  Bundle extras = new Bundle();
  Iterator var = message.getData().entrySet().iterator();

  while(var.hasNext()) {
   Map.Entry entry = (Map.Entry)var.next();
   extras.putString((String)entry.getKey(), (String)entry.getValue());
  }
   CleverTapAPI.processPushNotification(getApplicationContext(),extras);
  }
}

\\This code snippet is added inside the onMessageReceived() method of FCM Receiver Class

if (message.getData().size() > 0)
{
  val extras = Bundle()
  val `var` = message.getData().entrySet().iterator()
  while (`var`.hasNext())
  {
   val entry = `var`.next() as Map.Entry
   extras.putString(entry.getKey() as String, entry.getValue() as String)
  }
  CleverTapAPI.processPushNotification(getApplicationContext(), extras)
}
 

Scenario 2 : 'No' is Selected.


\\This code snippet is added only when you aren't rendering custom push (i.e. you have selected "NO")
<meta-data
   android:name="CLEVERTAP_BACKGROUND_SYNC"
   android:value="1"/>

Note :

  • Use Custom rendering only when you are not using createNotification method of ClevertapAPI to render. Only in that case you need to choose 'Yes'.
  • If createNotification method is used to render Clevertap push notification, you need to choose 'No'.

Geofencing

CleverTap offers geofencing which is a location-based service that customers can use to engage their audience by sending relevant messages to Android and iOS users who enter or exit a pre-defined location or geographic area.If you haven't already configured your project for Geofence, follow the instructions here :

File > New > Clevertap Assistant > Geofence.   View


Details and Values

  • Log Level : Default is DEBUG.
    • Logger.OFF - Turns off sdk logging
    • Logger.INFO - Prints info level sdk logging
    • Logger.DEBUG - Prints debug level sdk logging
    • Logger.VERBOSE - Prints verbose level sdk logging
  • Location Accuracy : Default is ACCURACY_HIGH. Applicable only for FETCH_CURRENT_LOCATION_PERIODIC
    • CTGeofenceSettings.ACCURACY_HIGH - provides the most accurate location possible, which is computed using as many inputs as necessary (it enables GPS, Wi-Fi, and cell, and uses a variety of Sensors), and may cause significant battery drain.
    • CTGeofenceSettings.ACCURACY_MEDIUM - provides accurate location while optimising for power. Very rarely uses GPS. Typically uses a combination of Wi-Fi and cell information to compute device location.
    • CTGeofenceSettings.ACCURACY_LOW - largely relies on cell towers and avoids GPS and Wi-Fi inputs, providing coarse (city-level) accuracy with minimal battery drain.
  • Location Fetch Mode : Default is FETCH_LAST_LOCATION_PERIODIC
    • CTGeofenceSettings.FETCH_LAST_LOCATION_PERIODIC - This value will use Periodic work manager which will fetch last known location from OS periodically(use setInterval() to set the interval). Location fetched using this may be less accurate and might be null in case Location is turned off in the device settings, the device never recorded its location or Google Play services on the device have restarted. This will give better battery optimisation with less location accuracy.
    • CTGeofenceSettings.FETCH_CURRENT_LOCATION_PERIODIC - This value will use Periodic Receiver which will fetch current device location from OS. Accuracy and battery optimisation can vary from high to low based on interval, displacement and accuracy values provided in CTGeofenceSettings.
  • Geofence Monitoring Count : Default is 50.
    • As per android documentation You can have multiple active geofences, with a limit of 100 per app, per device user.
    • SDK lets the App decide how many geofences they want to monitor through CleverTap by setting this value.
    • Use values in the range of 1-100
  • Interval Time : Default is 30 minutes. Applicable for both fetch modes. (Enter Values in milliseconds)
    • Values less than 30 minutes will be ignored by SDK. SDK will then handover this value to Google Location API
  • Fastest Interval Time : Default is 30 minutes. Applicable only for FETCH_CURRENT_LOCATION_PERIODIC. (Enter Values in milliseconds)
    • Values less than 30 minutes will be ignored by SDK. SDK will then handover this value to Google Location API
  • Smallest Displacement Distance : Default is 200 meters. Applicable only for FETCH_CURRENT_LOCATION_PERIODIC. (Enter values in meters)
    • Values less than 200 meters will be ignored by SDK. SDK will then handover this value to Google Location API
  • Backgroung Location : Default is true.
    • When true, this will allow SDK to register background location updates through any of the above mentioned fetch modes.
    • When false, this will inform SDK to fetch location only in foreground when the app is launched or through triggerLocation() and not to register background location updates through any of the above mentioned fetch modes.
  • Notification Responsiveness Time : Default is 0 milliseconds.
    • Sets the best-effort notification responsiveness of the geofence. Setting a big responsiveness value, for example 5 minutes(300000 milliseconds), can save power significantly. However, setting a very small responsiveness value, for example 5 seconds, doesn't necessarily mean you will get notified right after the user enters or exits a geofence: internally, the geofence might adjust the responsiveness value to save power when needed.

Affected Files

<!-- Permissions -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>

implementation 'com.clevertap.android:clevertap-geofence-sdk:1.0.2'
implementation 'com.clevertap.android:clevertap-android-sdk:4.1.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'androidx.work:work-runtime:2.3.4' // required for FETCH_LAST_LOCATION_PERIODIC
implementation 'androidx.concurrent:concurrent-futures:1.0.0' // required for FETCH_LAST_LOCATION_PERIODIC

\\Java
CTGeofenceSettings ctGeofenceSettings = new CTGeofenceSettings.Builder()
  .enableBackgroundLocationUpdates(bgLocation)//boolean to enable background location updates
  .setLogLevel(logLevel)//Log Level
  .setLocationAccuracy(accuracy)//byte value for Location Accuracy
  .setLocationFetchMode(fetchMode)//byte value for Fetch Mode
  .setGeofenceMonitoringCount(geofenceCount)//int value for number of Geofences CleverTap can monitor
  .setInterval(interval)//long value for interval in milliseconds
  .setFastestInterval(fastestInterval)//long value for fastest interval in milliseconds
  .setSmallestDisplacement(displacement)//float value for smallest Displacement in meters
  .setGeofenceNotificationResponsiveness(geofenceNotificationResponsiveness)// int value for geofence notification responsiveness in milliseconds
  .build();

CTGeofenceAPI.getInstance(getApplicationContext()).init(ctGeofenceSettings,cleverTapAPI);

//Kotlin
var ctGeofenceSettings = CTGeofenceSettings.Builder()
  .enableBackgroundLocationUpdates(bgLocation)//boolean to enable background location updates
  .setLogLevel(logLevel)//Log Level
  .setLocationAccuracy(accuracy)//byte value for Location Accuracy
  .setLocationFetchMode(fetchMode)//byte value for Fetch Mode
  .setGeofenceMonitoringCount(geofenceCount)//int value for number of Geofences CleverTap can monitor
  .setInterval(interval)//long value for interval in milliseconds
  .setFastestInterval(fastestInterval)//long value for fastest interval in milliseconds
  .setSmallestDisplacement(displacement)//float value for smallest Displacement in meters
  .setGeofenceNotificationResponsiveness(geofenceNotificationResponsiveness)// int value for geofence notification responsiveness in milliseconds
  .build()

CTGeofenceAPI.getInstance(getApplicationContext()).init(ctGeofenceSettings, cleverTapAPI)

Note :

  • CleverTapAPI needs to be initialized before the CTGeofenceAPI object is created because the object of CleverTapAPI is required to initialize the CleverTap Android Geofence SDK.
  • Runtime location permissions needed for SDK to work.
  • CTGeofenceAPI is automatically activated once the init() method has been called.
  • CleverTap Android Geofence SDK raises the “Geofence Cluster Entered” and “Geofence Cluster Exited” events automatically. The app cannot raise these methods manually.

Audit Report

An auditing function which tracks all background actions and events that happen within a minute of your application launch, helpful for reviewing the clevertap activities performed. To activate the audit report fucntion follow these steps :

  1. File > New > Clevertap Assistant > Audit Report. Click on the Audit report.   View
  2. The Plugin will add relevnt codes in to your project and will syn the app.
  3. Run the app onto the device or the emulator.
  4. Do the login sign out and relogin in under one minute for the plugin to capture the relevant details.

Affected Files.


<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />


implementation 'com.github.Anu2897:ReportGenerate-Android:1.1.4'


allprojects {
  repositories {
   maven { url 'https://jitpack.io' } //added by CleverTap Assistant
   google()
   jcenter()
  }
}


import android.content.Context;
import com.example.getauditreport.ReportGenerate;

public class MainActivity extends AppCompatActivity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
   Context context = getApplicationContext(); //added by CleverTap Assistant
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_main);
   ReportGenerate.run(context); //added by CleverTap Assistant
   clevertapDefaultInstance.setDebugLevel(CleverTapAPI.LogLevel.DEBUG); //added by CleverTap Assistant
  }
}


import android.content.Context;
import com.example.getauditreport.ReportGenerate;

class MainActivity : AppCompatActivity() {

  override fun onCreate(savedInstanceState: Bundle?) {
   var context = getApplicationContext()
   super.onCreate(savedInstanceState)
   setContentView(R.layout.activity_main)
   ReportGenerate.run(context)
   CleverTapAPI.setDebugLevel(CleverTapAPI.LogLevel.DEBUG)
  }
}


To view the resulting Audit report with all its details go to View > Tool Window > Device File Explorer.   View

Once the Device file explorer is open navigate to data > data > (project package name) > files > AuditReport.txt to view and download the Audit Report.

Note :

  • The Audit Report captures all the details upto 1 minunte from app launch and is available after the time passed.
  • It also requires a minimum sdk version 25 in build.gradle .
  • It is advisable to clear the logs and studio logcat to get a clear and informative report.

Push Templates

Push Templates SDK helps you engage with your users using fancy push notification templates built specifically to work with CleverTap. The Plugin helps you test such templates for push notification during the development phase or for testing purposes directly throught the code. The Plugin provides a preview of the actual notifications which will be sent to the user through the dashboard. Follow these steps to try different available push templates :

Step 1:
To add push templates into your project for testing.  Right Click > Push Templates > Integrate.   View
Step 2:
To test different notification push templates onto your physical device or emulator.  Right Click > Push Templates > Test.   View
Step 3:
Select from available types and enter the values required.  View



Affected Files.


<!-- Added by CleverTap Assistant-->
<service
  android:name="com.clevertap.pushtemplates.PTNotificationIntentService"
  android:exported="false">
  <intent-filter>
   <action android:name="com.clevertap.PT_PUSH_EVENT"/>
  </intent-filter>
</service>

<!-- Added by CleverTap Assistant-->
<receiver
  android:name="com.clevertap.pushtemplates.PTPushNotificationReceiver"
  android:exported="false"
  android:enabled="true">
  </receiver>

<!-- Added by CleverTap Assistant-->
<receiver
  android:name="com.clevertap.pushtemplates.PushTemplateReceiver"
  android:exported="false"
  android:enabled="true">
</receiver>


implementation 'com.clevertap.android:push-templates:0.0.8' //added by CleverTap Assistant
implementation 'com.github.KevalMajethiya:PushTemplateLibrary:0.1.0' //added by CleverTap Assistant


maven { url 'https://jitpack.io' } //added by CleverTap Assistant