Push Notifications in Native iOS Applications

improve this page | report issue

Overview

This tutorial explains how to configure a MobileFirst native iOS application to support push notifications.
Also mentioned are the addresses and ports that must be accessible for notifications to arrive to the supported Apple Push Notification Service vendor (APNS).

Prerequisite: Make sure to read the Configuring a native iOS application with the MobileFirst Platform SDK tutorial first.

This tutorial covers the following topics:

Setting up push notifications

To send push notifications to iOS devices, use the Apple Push Notifications Service (APNS).
You must be a registered Apple iOS Developer to obtain an APNS certificate for your application.
Note: APNS certificates must have a non-blank password.

  • During the development phase, use the apns-certificate-sandbox.p12 sandbox certificate file.
  • During a production phase, use the apns-certificate-production.p12 production certificate file.

To learn about setting up the certificates that are required for push notifications, see this blog post: Understanding and setting up certificates required to use iOS devices and Apple Push Notifications services (APNS)

missing_alt

  1. Create a MobileFirst project and add a MobileFirst iOS Native API.
  2. Place the Apple APNS certificate file at the root of the application folder.
  3. In application-descriptor.xml, add the pushSender element under the nativeIOSApp environment. These settings are also editable with the Application Descriptor Editor in Design mode.
    • Replace the password value with the .p12 certificate password.
    • Replace the bundleId value with your application bundleId value. Consult the Apple documentation about how to create a bundleId for Xcode projects.
    • For example:

      <nativeIOSApp id="AppName" bundleId="com.REPLACE-WITH-BUNDLE-ID" platformVersion="7.0.0.00.20150312-0731"
      	version="1.0" xmlns="http://www.worklight.com/native-ios-descriptor">
      	<displayName>AppName</displayName>
      	<description>AppName</description>
      	<accessTokenExpiration>3600</accessTokenExpiration>
      	<userIdentityRealms></userIdentityRealms>
      	<pushSender password="REPLACE-WITH-CERTIFICATE-PASSWORD"/>
      </nativeIOSApp>
  4. Deploy the MobileFirst native API:

    CLI

    Use mfp deploy from within the application folder.

    Studio

    Right-click the Native API folder and select Run As > Deploy Native API.

Apple Push Notifications Service

For push notifications to be sent, the following servers must be accessible from a MobileFirst Server instance:
Sandbox servers:
gateway.sandbox.push.apple.com:2195
feedback.sandbox.push.apple.com:2196

Production servers:
gateway.push.apple.com:2195
Feedback.push.apple.com:2196

1-courier.push.apple.com 5223

Notification types

Inclusive terminology note: The Mobile First Platform team is making changes to support the IBM® initiative to replace racially biased and other discriminatory language in our code and content with more inclusive language. While IBM values the use of inclusive language, terms that are outside of IBM's direct influence are sometimes required for the sake of maintaining user understanding. As other industry leaders join IBM in embracing the use of inclusive language, IBM will continue to update the documentation to reflect those changes.
Last modified on November 09, 2016