Overview
You will learn
- How to set up push notifications on an Apple Developer and Google Firebase account
- How to configure push settings on SAP Mobile Services
- How to send push notification in your branded MDK client
Prerequisites
Prerequisites
- Tutorial: Set Up Initial Configuration for an MDK App
- Tutorial: Follow steps 2-6 in Enable Push Notifications in the MDK Public Store Client to create an MDK metadata project
- Tutorial: Follow steps 1-3 in Build Your Mobile Development Kit Client Using MDK SDK to create your local MDK project
- Apple ID: A paid Apple developer account is required.
Steps
Make sure you are choosing the right device platform tab above.
Open the Firebase console, login with your Google account and click Create a new Firebase Project.

Firebase Console Create New Project Provide a Project Name, click Continue.

Firebase Project Name Entry Uncheck Enable Gemini in Firebase option and click Continue.

Uncheck Enable Gemini In Firebase Option Uncheck Enable Google Analytics for this project option and click Create Project.

Uncheck Google Analytics Create Project Once the project is ready, click Continue.

Firebase Project Ready Continue Click Add app and click Android icon to add Firebase to your Android app.

Firebase Add Android App Provide a unique name to Android package name, click Register app.

Android Package Name Register App Download goole-services.jsonfile, click Next.
Download google-services.json File In Add Firebase SDK step, click Next.
In the following step, click Next and then click Continue to console.

Continue To Firebase Console Go to the Project settings.

Firebase Project Settings Navigation Select the Service accounts tab and click on the Generate new private key.

Service Accounts Generate New Private Key Click the Generate key in the pop-up window and store the downloaded private key file securely because the key cannot be recovered if lost.

Generate Key Confirmation Pop-up
In order to implement Push Notifications, a paid Apple developer account is required. Students or other developers with a personal Apple ID for their team will not be able to use push notifications, because they will not have access to the Developer Portal to generate the required certificate.
To enable your app for push notifications, you need to carry out the following tasks:
- Obtain a certificate signing request
- Create a new development certificate
.cerfile - Install the
.cerfile and create the .p12 file - Register an iOS App ID
- Register your device
Obtain a certificate signing request
In order to use the Apple Push Notification service, you need to create a CSR file.
On your Mac, open the Keychain Access application, and navigate to Keychain Access > Certificate Assistant > Request a Certificate From a Certificate Authority…

Keychain Access Certificate Request Menu In the dialog, enter the email address which is associated with your Apple Developer account. Also, make sure you check the Request is saved to disk option.

Certificate Request Saved To Disk Dialog Click Continue.
Choose a folder to store the certificate – it is good practice to store generated files in a separate folder for each project – and click Save.
Once you see a dialog saying the certificate is saved successfully, click Done to finish.

Certificate Saved Successfully Dialog Create a new development certificate
.cerfileGo to your Apple Developer Account and Click Certificates.

Apple Developer Account Certificates Section Click + icon to register a unique Identifiers for your application.

Apple Developer Add New Identifier Select App IDs and click Continue.

Select App IDs Option Provide a unique Bundle ID name and Description.

Bundle ID And Description Entry Scroll down and select the Push Notifications capability from the list, click Continue.

Push Notifications Capability Selection In the following screen, select option for Deployment Details and then click Continue.
Confirm your App ID by clicking on Register.
Create a new development certificate
.cerfileUnder Identifiers, search for the App ID that you registered in previous step.

Identifiers App ID Search Result Scroll down and select the Push Notifications capability, click Configure.

Push Notifications Capability Configure To configure push notifications for the provided App ID, a Client SSL Certificate is required that will allow the notification server to connect to the Apple Push Notification Service. Each App ID requires its own Client SSL Certificate.
Click Create Certificate to start the process for creating the needed
.cerfile.
Create Certificate For Push Notifications Click Choose File and browse to the downloaded Signing Request
CSRfile, click Continue.Apple will now create a
.cerfile for you which is issued by the Apple Worldwide Developer Relations Certification Authority.
CSR File Upload Certificate Creation Click Download to download your certificate.

Download Apple Push Certificate Install the
.cerfile and create the .p12 fileIn order to configure the
APNSon SAP Mobile Services, you need to install the.cerfile and create the needed.p12file.A
.p12file is a encrypted container for the certificate and private key. This file is needed by Mobile Services for theAPNSconfiguration.Locate your downloaded
.cerfile and double-click it in order to install the certificate.In case the Add Certificate dialog pops up make sure to choose Login from the dropdown and click Add.
If the certificate is added correctly to the Keychain you should see it in the
MyCertificatessection, make sure you selected login as keychain.
Keychain MyCertificates Login Section Select the certificate as well as the private key and right-click to export those two items.

Certificate And Private Key Export Make sure that in the dropdown Personal Information Exchange (.p12) is selected and click Save. You will be prompted to enter a password, click OK to export the files.

Personal Information Exchange P12 Export Register your device
Click + icon to register your iOS device.

Register iOS Device Plus Icon Provide Device Name & Device ID (UDID) and then click Continue.

iOS Device Name And UDID Entry
Make sure you are choosing the right device platform tab above.
In Mobile Services admin UI, navigate to
Mobile Applications|Native/MDK|myapp.mdk.demo|Push Notification.If you have selected Predefined for option, switch to the empty value. You should see Android option showing up on the page. Click Browse… to load the downloaded private key file.

Android Push Private Key Browse You should see the values showing up, click Save to save the changes.

Android Push Notification Settings Save
In Mobile Services admin UI, navigate to
Mobile Applications|Native/MDK|myapp.mdk.demo|Push Notification.If you have selected Predefined for option, switch to the empty value. You should see options showing up on the page. Provide the following details to the Apple panel and click Save.
Field Name Value APNS Endpoint Select Sandboxfrom the dropdownAuthenticate Choose CertificateCertificate Browse to the.p12certificate you just exportedPassword Enter the password you provided during the export 
Apple APNS Certificate Configuration Save
You have now successfully configured the APNS Endpoint on the server side in Mobile Services admin UI.
Make sure you are choosing the right device platform tab above.
Paste the downloaded google-services.json file to /DemoSampleApp.mdkproject/App_Resources/Android/ path.

Create a new file named as
app.entitlementsand place it under/DemoSampleApp.mdkproject/App_Resources_Merge/iOS/path.
app.entitlements File In iOS Resources Open this file and copy & paste the below information:
XML<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>aps-environment</key> <string>development</string> </dict> </plist>Assign a value of development or production to aps-environment key, depending only on which activity you are creating the provisioning profile for.
Follow step 4 from Build Your Mobile Development Kit Client Using MDK SDK tutorial to create your branded MDK client.
Make sure you are choosing the right device platform tab above.
Follow step 5 from Build Your Mobile Development Kit Client Using MDK SDK tutorial to create your branded MDK client.
Once you accept the App update, a message should show Push Notification registered. Click OK.

Push Notification Registered Confirmation It is time now to send the first push notification from the SAP Mobile Services push notification feature.
Navigate to Mobile Services admin UI. In Push Notification feature, switch to Push Registrations tab.
There you will find information about user registered for push notification and also details about Push providers. Identify your Device ID and click Send Notification.

Push Registrations Tab Send Notification In notification dialog, type a notification message and click Send.

Push Notification Message Send Dialog You will see a success toast message.

Push Notification Success Toast Message After sending notification, mobile device should receive the message. This example uses the simplest notification that only contains the alert property.

Android Device Received Push Notification
Follow step 5 from Build Your Mobile Development Kit Client Using MDK SDK tutorial to create your branded MDK client.
After accepting the app update, allow the permission to display notifications. If push registration is successful, a message should show Push Notification registered. Click OK.

iOS Push Notification Permission Request 
iOS Push Notification Registered Confirmation It is time now to send the first push notification from the SAP Mobile Services push notification feature.
Navigate to Mobile Services admin UI. In Push Notification feature, switch to Push Registrations tab.
There you will find information about user registered for push notification and also details about Push providers. Identify your Device ID and click Send Notification.

Push Registrations Tab Send Notification In notification dialog, type a notification message and click Send.

Push Notification Message Send Dialog You will see a success toast message.

Push Notification Success Toast Message After sending notification, mobile device should receive the message. This example uses the simplest notification that only contains the alert property.

iOS Device Received Push Notification If you have Apple watch connected to the iPhone device, you can also see same push notification on the Apple Watch.

Apple Watch Push Notification Display MDK supports rich push notification. MDK does not run on smart watches or as an Apple watch application.
Make sure you are choosing the right device platform tab above.
Based on the device Operating System, notifications are handled differently. On Android, the notification is a data message and only handled by the apps notification callback. The callback is only called when the app is active. So, how can you make it visible always? You use the advanced Message properties:
gcm.title/gcm.bodyfor your message. For more information on Google/Firebase Cloud Messaging, see documentation.Send the Android client in the background or swipe close.
Switch to the Advanced tab, provide below payload and click Send.
JSON{ "alert": "Alert message", "gcm": { "title": "MDK Push", "body": "This is an advanced notification message" } }
Advanced Android Push Notification Payload Send After sending notification, you will see a notification in the notification center.

Android Notification Center Push Message
Based on the device Operating System, notifications are handled differently. On
iOSoriPadOSthe notification is handled by the app when in foreground, but handled (and displayed) by the Notification Console and shown in the Lock Screen, when the app is in background. So, how can you make it visible always? You use the advanced Message properties:apns.title/apns.bodyfor your message. For more information on Apple Remote Notification, see documentation.Send the iOS client in the background or swipe close.
Switch to the Advanced tab, provide below payload and click Send.
JSON{ "alert": "Alert message", "apns": { "title": "MDK Push", "body": "This is an advanced notification message" } }
Advanced iOS Push Notification Payload Send After sending notification, you will see a notification in the notification center.

iOS Notification Center Push Message
Congratulations, you have successfully enabled push notification in your branded client and you can continue with the remaining tutorials in this mission.
Resources
Discussion
Share feedback on this tutorial or join the conversation in SAP Community.