The registration details contain all of the 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.
- Is push registered: A flag that indicates whether the device is registered with GCM (true for registered, false for not registered).
- Push token: The registration ID received from GCM after registration. It is null if registration was not performed yet.
When you integrate the Mobile Customer Engagement library within your app, you want to persist the channel ID and user ID within your own user table so that you can associate your user’s PII with the user ID and channel ID. How you persist this value is up to you. The following example shows you how to grab the details properties in Java:
RegistrationDetails registrationDetails= MceSdk.getRegistrationDetails(getApplicationContext()); String channelId= registrationDetails.getChannelId(); String userId=registrationDetails.getUserId(); boolean isPushRegistered= registrationDetails.isPushRegistered(); String pushToken= registrationDetails.getPushToken(); String appKey = MceSdk.getRegistrationClient().getAppKey(getApplicationContext());
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 MceBroadcastReceiver onSdkRegistered 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, you can obtain MCE registration details by using MceNotificationActionRegistry.
MceNotificationActionRegistry is for registering custom SDK notification actions. If you want to get a user ID and channel ID after the device is registered, you must implement the MceBroadcastReceiver class.
This class retrieves the user ID and channel ID in the onSdkRegistered method by using the MceSdk.getRegistrationDetails().getUserId() and MceSdk.getRegistrationDetails().getChannelId() methods.
If you want to obtain the push token, you must implement the onDeliveyChannelRegistered method and use the MceSdk.getRegistrationDetails().getPushToken() method.
Go Back to the Mobile App Messaging home page.