Track Engagements

You can track engagements triggered by SDK. Just add the below code in you Activity:

private Context mContext = null;
private Moments mMomentsClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Do something of your insterest.
mContext = this;
initializeLotaDataSDK();
}
private void initializeLotaDataSDK() {
mMomentsClient = MomentsClient.getInstance(this) {
trackEngagements();
}
protected void trackEngagements() {
//Receives that handles notification
NotificationReceiver notificationReceiver = new NotificationReceiver(
101, R.drawable.lotadata_notification_icon, RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)) {
@Override
public void notificationClicked(Context context, String actionText, String actionLink) {
//Compose intent to start activity that contains webview
Intent myIntent = new Intent(context, EngagementActivity.class);
myIntent.putExtra(Moments.LD_NOTIFICATION_ACTION_TEXT, actionText);
myIntent.putExtra(Moments.LD_NOTIFICATION_ACTION_LINK, actionLink);
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(myIntent);
}
};
mMomentsClient.trackEngagements(notificationReceiver);
}
protected void untrackEngagements() {
if(mMomentsClient != null) mMomentsClient.untrackEngagements();
}
@Override
protected void onDestroy() {
if (mMomentsClient != null) {
untrackEngagements();
mMomentsClient.disconnect();
}
super.onDestroy();
}

Questions?

We are eager to hear from you and happy to share best practices for integrating the SDK. There are many ways for you to reach us:

But first, please sign up for an account with LOTaDATA so that we may send you the link to download our SDK.