Overview

Skill Level: Any

The registration detail properties are not available until the device is registered.

Registration initially happens within seconds of first launching your mobile app; however, you can obtain MCE registration details in the AppDelegate class.

Prerequisites

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

Step-by-step

  1. Obtaining MCE registration details:

    Use the following methods to obtain MCE registration details in the App Delegate class:

    -(void) aquireIdentification: (NSNotification*)note
    {
    NSString * userId = [MCERegistrationDetails userId];
    NSString * channelId = [MCERegistrationDetails channelId];
    MCEConfig * config = [[MCESdk sharedInstance] config];
    NSString * appkey = config.appKey;
    }
    
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(aquireIdentification:) name: @"MCERegisteredNotification" object: nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(aquireIdentification:) name: @"MCERegistrationChangedNotification" object: nil];
    }
    

    NSNotification is required if you want to know immediately when the device registers with the MCE servers. You can also query the user ID and channel ID from the registration details.

    Tip: The registration details properties are not available until the device is registered. If you want to obtain the registration details and send them to your server, use the observer pattern described.

    If you enable file sharing, the user ID and channel ID can be saved to iTunes in a file that is named mce-details.txt. mce-details.txt includes all the information about your environment and configuration, such as the log level, app key, base URL, and session timeout. This information is helpful when you try to debug problems. You can enable file sharing by setting the UIFileSharingEnabled flag to YES in info.plist.

    Go Back to the Mobile App Messaging home page.

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 *