Set up mobile applications

 

 

About Mobile Applications

To create and manage mobile applications (apps), you must first ensure that you have downloaded and activated the mobile SDK for your iOS or Android mobile device.  

Create Mobile Applications

    Before working with your application, you need to create and register your mobile application.

    1. From the side menu, navigate to Settings > Manage Mobile Applications.
    2. Click Create New Event.
    3. Specify the application name and ID. The system uses the application ID to associate the application with the mobile events and spots that you create. The application ID must be unique.
    4. Enter the required credentials for Apple or Google notifications:

    Click Edit in the Apple Production Certificate and Key section. Enter the Apple production certificate and key, and then click OK. For more information about setting up your iOS device, see the appropriate Apple Developer website.

    To obtain the certificate and key:

    1. Generate a Certificate Signing Request (CSR) by navigating to Keychain Access > Certificate Assistant > Request a Certificate from a Certificate Authority.

        Enter an email address and the application name.

        Select Save to Disk to generate the appname.certSigningRequest.

        Click Continue to save the file to your project folder.

    2. Log on to the Apple Developer site.

    3. In the iOS Apps section, select Identifiers > App IDs > +.

        In the App ID Description section, enter a Name.

        In the Explicit App ID section, enter a Bundle ID.

        In the App Services section, select Push Notifications.

        Click Continue, and then click Submit.

        The app is now registered to your account. Click Done.

    4. In the iOS Apps section, select Certificates > All > +.

        In the Development section, select Apple Push Notification service SSL (Sandbox).

        Select an App ID and click Continue.

    5. Upload the CSR file that you created in the first step.

        Click Choose File, and then click Generate.

        Click Download to download the certificate to your project folder.

    6. At a command prompt, use this command to convert the .cer file to a .pem file to make it readable:

             openssl x509 -in aps_development.cer -inform der -out AppNameCert.pem

        A certificate key is displayed. Copy and paste the entire certificate key into the appropriate field in SAS Customer Intelligence 360.

        Follow these steps to complete the process:

    7. You also need to convert the private key .p12 file to a .pem file.

        In the login keychain, find your appname. Right-click the appname, and then click Export. Provide a password. The file is exported as appnameKey.p12.

        At a command prompt, use this command to convert the .p12 file to a .pem file to make it readable:

            openssl pkcs12 -in AppNameKey.p12 -out AppNameKey.pem -nodes –clcerts

        A private key is displayed. Copy and paste the entire key into the appropriate field in SAS Customer Intelligence 360. When both the certificate and the key are added, click Done.

        Continue with the following steps to complete the process.

    8. To obtain a provision profile, in the iOS Apps section, select Provisioning Profiles > Development > +.

        Select iOS App Development and click Continue.

        Select an App ID and click Continue.

        Select certificates to include in the provisioning profile and click Continue.

        Select devices to include in the provisioning profile and click Continue.

        Enter a Profile Name and click Generate.

        Click Download to save the file to your project folder, and then double-click the file to install the provisioning profile.

    9. In your AppDelegate applicationWillEnterForeground: method, add an attempt to register for Remote Notifications:

           [[UIApplication sharedApplication] registerForRemoteNotifications];

    10. The registration is an opt-in operation, so there is interaction with the user before the registration can proceed. You need to respond to the registration.

    
    -(void)application:(UIApplication *)application
    didRegisterForRemoteNotificationsWithDeviceToken:
    (NSData *)deviceToken
    {
    NSLog(@"My token is: %@", deviceToken);
    const unsigned *tokenBytes = [deviceToken bytes];
    NSString *token = [NSString stringWithFormat:
    @"%08x%08x%08x%08x%08x%08x%08x%08x",
    ntohl(tokenBytes[0]),
    ntohl(tokenBytes[1]), ntohl(tokenBytes[2]),
    ntohl(tokenBytes[3]),
    ntohl(tokenBytes[4]), ntohl(tokenBytes[5]),
    ntohl(tokenBytes[6]),
    ntohl(tokenBytes[7])];}
    
    - (void)application:(UIApplication*)application
    didFailToRegisterForRemoteNotificationsWithError:
    (NSError*)error
    {
    NSLog(@"Failed to get token, error: %@", error);
    }
    

    11. In the didRegisterForRemoteNotificationsWithDeviceToken method, you get a device token. This token must be sent to the server for storage because the token is used when sending the push notification. Push notifications are generally expected to be seen outside the app. If you also want to respond to the notification when the app is in the foreground, you need to add an implementation of didReceiveRemoteNotification:

    
    -(void)application:(UIApplication *)application didReceiveRemoteNotification:
    
    (NSDictionary *)userInfo
    {
    if (![SASCollector handleMobileMessage:userInfo
    WithApplication:application])
    {
    // handle the message here. It is not a message for SASCollector
    }
    }
    

    Click Edit in the Apple Development Certificate and Key section, and then enter the Apple development certificate and key. For more information, see the instructions in theApple Production Certificate and Key section. Click OK.

    Click Edit in the Google Cloud Messaging API Key section, and then enter the Google cloud messaging credentials. For the most recent information about registering and setting up your mobile app on Android, see the appropriate Google Developers website. To obtain the key:

    1. Register your mobile app with Google Cloud Messaging (GCM) to receive a server key.
    2. Obtain a google-services.json configuration file and add it to the app directory of your project. During this process, the Server API Key and Sender ID are displayed. Copy and paste the Server API Key into the appropriate field in SAS Customer Intelligence 360. Click Done.

    Follow these steps to complete the process:

    1. Add the Google Services plug-in to your project by updating your top-level build.gradle and your app-level build.gradle files.
    2. Set up your project to use the Google Play services SDK in the dependency section of your application’s build.gradle file.
    3. Ensure that the following information is added to your application’s manifest:

    - GCMReceiver declaration
    - GCMListener implementation and declaration (MyGcmListenerService)
    - InstanceIDListener implementation and declaration
    - WAKE_LOCK permission
    - Application C2D_MESSAGE permission declaration and usage entry

    Your GCM setup is now complete.

    6. When your GCM implementation gets the GCM token (possibly in your own IntentService or AsyncTask), pass the token to the SASCollector:

    
    SASCollector.getInstance().registerForMobileMessage(token,
    new SSMobileMessagingDelegrate() {
    @Override
    public void dismissed() {
    Log.d(TAG, “Message dismissed.”);
    }
    
    
    @Override
    public void action(String s) {
    Log.d(TAG, “Message action.” + s);
    }
    

    7. When your GCM implementation receives a GCM message (in your implementation of GCMListener), pass the message bundle to the SASCollector, using the return value to signal whether the message was handled:

    
    @Override
    public void onMessageReceived(String from, Bundle data) {
    
    if(!SASCollector.getInstance().handleMobileMessage(data)) {
    
    //The message was not intended for the SASCollector
    //process the bundle with your own logic
    
    }
    }
    

    Manage Mobile Applications

    You can select and download the framework for an application.

    From the side menu, navigate to Settings > Manage Mobile Applications.
    Click Select and select the appropriate application.Click to download the application framework. A ZIP file appears at the bottom of the screen. Click the ZIP file to access the Android and iOS files.

    You can delete an application by selecting the application and clicking .


    Be a part of the SAS® Customer Intelligence Community

    Meet and mingle with other users in the SAS Customer Intelligence Community. Ask questions. Get answers. Share tips. It's a great place to learn, grow and collaborate.        

    Join the community

    More Ways to Learn

    users-guides-computer-book

    User's Guides

    Get guidance on optimizing marketing activities, analyzing visitor behavior, and gaining a 360-degree customer view.

    computer-with-keyboard

    Training

    Explore our training options – from on-site classroom, to live web, to e-learning, to one-on-one mentoring.

    light-blub-plant

    Certification

    Validate your SAS knowledge and skills. Earn a globally recognized credential from SAS to set yourself apart.

    Back to Top