Android Integration

Initialization

1. Import the InMobi SDK header and initialize it.

InMobiSdk.init(this, "Insert InMobi Account ID here", consentObject, new SdkInitializationListener() {
    @Override
    public void onInitializationComplete(@Nullable Error error) {
        if (null != error) {
            Log.e(TAG, "InMobi Init failed -" + error.getMessage());
        } else {
            Log.d(TAG, "InMobi Init Successful");
        }
    }
});

2. Create a user data model as follows:

InMobiUserDataTypes phoneNumber = new
InMobiUserDataTypes.Builder().md5("2wse3e").sha1("5tfg7yh").sha256("6tghjk").build();
InMobiUserDataTypes emailId = new I
nMobiUserDataTypes.Builder().md5("ujhjk99").sha1("9ujkhgtyf").sha256("jhjyure4").build();
HashMap<String, String> extras = new HashMap<>();
extras.put("appSpecificUniqueId", "XXXXXXXX");
InMobiUserDataModel userDataModel = new
InMobiUserDataModel.Builder().phoneNumber(phoneNumber).emailId(emailId).extras(extras).build(); 

3. Pass this data model to fetch the API.

InMobiUnifiedIdService.push(userDataModel)

4. Use this API to fetch the UnifIDs.

InMobiUnifiedIdService.fetchUnifiedIDs(this)

Callbacks

Implement the following delegates to receive the callbacks.

class MyActivity implements InMobiUnifiedIDInterface {
   @Override
        public void onFetchCompleted(JSONObject response, Error error) {
        }
} 

Reset

Call this reset API to clear all the user-related data and Ids stored in the SDK.

InMobiUnifiedIdService.reset()

Publisher provided Unified Ids (Optional)

If you have an ID from a Vendor, you can use it in the following SDK. If there is an overlap, the system prioritizes the InMobi procured Unified IDs.

InMobiSdk.setPublisherProvidedUnifiedID(JSONObject unifiedIds);

JSONObject structure:

{ 
    "id5" : "json(blob)", 
    "live Ramp": "json(blob)" 
} 

Recommended Usage

InMobi’s Unifi APIs expects hashed e-mail or telephone numbers to generate the identity envelope. To enhance matching, ensure to

  • Remove whitespace, blank spaces, tabs, and other characters from the plain language e-mail id.
  • Convert all the uppercase characters to lowercase.
  • Validate the email id against a regular expression.

Example: test@example.com, test@gmail.com.

Note

For email ids with @gmail.com:

  • Remove ‘.’ (ASCII code 46) from the username of the e-mail address. jane.doe@gmail.com normalizes to janedoe@gmail.com.
  • Remove ‘+’ (ASCII code 43) and all subsequent characters from the username of the e-mail address. janedoe+home@gmail.com normalizes to janedoe@gmail.com.

On This Page

Last Updated on: 01 Feb, 2022