SDK Methods

Real-time CDP supports the following SDK methods for Android app:

Customer Profiles

Use the following method to create and enrich the customer profile.

Copy
Customer customer = new Customer(); 
customer.setCustomerCode(“12345”);
customer.setEmail("abc@gmail.com”);
customer.setMobileNo(“4544454445”); 
TargetOneMobileSDK.getInstance().setCustomerProfile(context, customer);

Clickstream Events

Use the following method to invoke the Clickstream event API whenever one of the supported event types is triggered in the app.

Copy
TargetOneMobileSDK.getInstance().sendClickStream(context,eventType, eventData, (APIResponseInterface)this);

Note: For more information about event types and event data, see Event Types.

  • context: Refers to context of the current state of the application/object.

  • eventType: Refers to the event name for which the Clickstream API is called.

    For example, eventProduct.

  • eventData: Refers to JSONObject based on supported eventTypes.

  • this: Refers to APIResponseInterface.

Use the following APIResponseInterface method to enable API response callback.

Copy
@Override
public void onCallback(int statusCode, JSONObject jsonObject) {
/* Here statusCode refers to StatusCode of API Response
&
jsonObject refers to JSONObject Response for realtime API
*/
}

In-App Notifications

Real-time CDP SDK allows you to show in-app notifications to your users. You can design the in-app notifications from the dashboard, without writing any code.

Block In-App notifications

Use the following code to block In-App notification on specific page or activity:

Copy
TargetOneSDKContext.blockInApp.add(String ActivityName);//blockInApp is list of String

Disable Notification Auto Integration (Manual)

By default, Real-time CDP SDK supports the auto integration by adding the Real-time CDP MyFirebaseBase class in the AndroidManifest.xml file. If you have your own Firebase class, then you should pass the device tokens and message handler to display the custom push and in-app push from Real-time CDP.

Send FCM Token to Real-time CDP

Copy
public void onNewToken(String s) {
    TargetOneMobileSDK.getInstance().registerFcmToken(getApplicationContext(), s);
}

Handle Push Message by Real-time CDP

If the notification is from Real-time CDP, then it will handle else it will return false.

Copy
if (!TargetOneMobileSDK.getInstance().handleFcmNotification(getApplicationContext(), remoteMessage))
 {
    Log.v(TAG, "Notification Not From TargetOne”);
}