Push Notifications in Native iOS Applications
improve this page | report issueOverview
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)
- Create a MobileFirst project and add a MobileFirst iOS Native API.
- Place the Apple APNS certificate file at the root of the application folder.
- In
application-descriptor.xml
, add thepushSender
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 applicationbundleId
value. Consult the Apple documentation about how to create abundleId
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>
- Replace the
- 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
▲- Event Source Notifications in Native iOS Applications
- Interactive and Silent Notifications in Native iOS Applications
- Tag and Broadcast Notifications in Native iOS Applications
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.