GuidesDiscussions
Log In

Client Attributes

Optional

Step 7: Passing Client Attributes to the DR SDK

In some cases, the host application may need to pass attributes to the DR SDK. This is supported with the ClientAttributes class provided as part of the SDK. Currently, we support up to 10 different client attributes.

To set client attributes and pass them to the DR SDK, follow this code snippet:

// Set client attributes to be sent to DR SDK
ClientAttributes attributes = new ClientAttributes();

// Set necessary values
attributes.setValue("Param1", "Value1");
attributes.setValue("Param2", "Value2");

// Pass the values to the DR SDK
IUApp.setClientAttributes(this, attributes);

Note: Avoid Data Override: Please note that all values need to be passed together to the SDK before the setClientAttributes method is called. Calling the method multiple times will overwrite the previous data, and only the new value will be available and sent to DR servers.

The following are the pre-defined keys we have:

  • Phone number: "PHONE_NUMBER"
  • Carrier: "CARRIER"
  • Bill type: "BILL_TYPE" (POSTPAY or PREPAY)

In addition to the keys above, you are free to add your own keys. DR will store the information in the database for future reference.

Here are some examples:

Example 1: Setting the Phone Number

ClientAttributes attributes = new ClientAttributes();
attributes.setValue("PHONE_NUMBER", "1234567890123"); // Replace with actual user information
IUApp.setClientAttributes(this, attributes);

Example 2: Setting the Bill Type and Custom Key

ClientAttributes attributes = new ClientAttributes();
attributes.setValue("BILL_TYPE", "POSTPAY"); // Replace with actual user information
attributes.setValue("new_key", "New value");
IUApp.setClientAttributes(this, attributes);

External ID

You can set the partner ID, external ID, or host app reference ID using the client attributes. We have reserved the key "EXTERNAL_ID" for this purpose.

Example:

ClientAttributes attributes = new ClientAttributes();
attributes.setValue("EXTERNAL_ID", "[email protected]"); // Replace with actual user information
IUApp.setClientAttributes(this, attributes);