Overview

Skill Level: Intermediate

Prerequisites

Not what you’re looking for? Check out all our available tutorials for mobile app messaging here.

Step-by-step

  1. Register the SDK:

    The registration details contains properties that are related to the SDK registration. The SDK registration includes the following properties:

    • channel ID: The unique identifier that is assigned to your device upon successful registration.
    • user ID: The unique user identifier that is assigned upon successful registration.

    When you integrate the Mobile Customer Engagement library within your app, you should persist the channel ID and user ID within your own user table so that you can associate any private data with that device’s and/or user’s identity. How you persist this value is up to you. The following example shows you how to obtain the properties in Cordova:

    MCEPlugin.getRegistrationDetails(function(details) {
        if (typeof details.userId == "undefined" || typeof details.channelId == "undefined") {
            // Not yet registered, no user/channel
        }
        console.log("UserId is " + details.userId);
        console.log("ChannelId is " + details.channelId);
    });
    
    MCEPlugin.getAppKey(function(appKey) {
        console.log("AppKey is " + appKey);
    } 
    

    Tip: The registration details properties are not available until the device is registered. If you want to obtain the registration details and send it to your server, do it in the MCEPlugin.setRegistrationCallback(function(details) mechanism. The sample app included in the SDK has additional information about how to get the registration details.

    Obtaining registration details

    Registration initially happens within seconds of first launching your mobile app. However, if your app is started while a user is not on a data or wifi network, it will be deferred until a network is available. App key is always available.

Expected outcome

Need more help? Check out all of our available tutorials for mobile app messaging here.

Join The Discussion

Your email address will not be published. Required fields are marked *