SAP Fiori Client Guide

Push Notification Plugin

(Android, iOS) Push plugin APIs allow you to send push data from the back-end data source to SAP Fiori Client applications or packaged Fiori applications.

(Android, iOS) Push Notifications for SAP Fiori Client Through the SAP Fiori Launchpad Notifications View

The SAP Fiori launchpad Notifications view helps end users manage push notifications for an SAP Fiori Client or a packaged Fiori application. From the Notifications view, end users can accept, approve, or reject notifications.

Push notifications are sent to all devices registered to a particular user instead of to a specific device registration ID, which ensures that end users receive all notifications on all of their devices rather than just one. The same notifications are accessible from any registered device.

To add push capabilities to the Fiori launchpad, the launchpad calls the sap.Push.initPush function with the push handler function _handlePushedNotification. This handler performs the following operations:
  • (iOS) Fetches the notification data and updated badge number.
  • Updates the Fiori launchpad notifications icon and the Notifications view with the new data.
  • (iOS) Updates the SAP Fiori Client application icon badge number.

The following sample code demonstrates these operations:

document.addEventListener("deviceready", this._registerForPush.bind(this), false);  
this._registerForPush = function () { 
   sap.Push.initPush(this._handlePushedNotification.bind(this));
}

(iOS) Badge Management

A badge number alerts an end user to the total number of unread notifications that are available to view. Badge numbers are located in the following two places:
  • On the SAP Fiori Client application icon
  • On the Notifications icon found in the upper right-hand corner of the Fiori launchpad

When an end user taps or clicks the Notifications icon in the Fiori launchpad, the Notifications view opens, and the badge count returns to 0 and then disappears from the Fiori launchpad. When new notifications are available, a new badge number will appear.

Badge Management from the SAP Fiori Launchpad

When launched, the Fiori launchpad fetches notification data and the badge count by issuing a getBadgeNumber call to the back-end.

For the Fiori launchpad UI, badge management is enabled or disabled using the UShell configuration flag that creates the Notifications view and the badge number. For example:
renderers: {
         fiori2 : {
              componentData: {
                  config: {
                enableNotificationsUI: true,
When enableNotificationsUI is false, the Notifications view and badge number aren't created and therefore don't appear in the Fiori launchpad.
For push capabilities to be enabled for the Fiori launchpad, the Notifications UShell service must be initialized. For example:
services: {
        Notifications: {
              config: {
                 enabled: true,
When enabled is false, the Notifications UShell service is not initialized, which means that notification data and the badge count are not fetched from the backend, and there are no registrations for any push actions.

Badge Management for the SAP Fiori Client Application Icon

Once the Fiori launchpad retrieves the notification data and the badge count, the Fiori launchpad updates the SAP Fiori Client application icon badge number using the sap.Push API setBadgeNumber(). This ensures consistency between badge counts visible on the SAP Fiori Client app icon and the Fiori launchpad notifications icon.

Remote Push Notification Support for iOS

(Hybrid SDK (Kapsel) and custom SAP Fiori apps only) The Push Notification plugin supports remote notifications on the client. In iOS7, Apple introduced a new capability that enables applications to fetch new data when an application is running in the background. This background fetch is either performed by the OS at a suggested minimum interval; or in response to a special APNS push request called a Remote Notification.

Remote Notifications are APNS push requestswith one additional payload field that is new to iOS7:
“aps” : 
{ "content-available": 1 } 

When an iOS7 device receives a Remote Notification, the Application Delegates didReceiveRemoteNotification method is called. This occurs when the application is running in the background as well as the foreground and gives the developer an opportunity to reconcile application data with a back-end server.

SAP Mobile Platform Server allows you to set the HTTP header X-SMP-APNS-CONTENT-AVAILABLE when making an HTTP notification request to add the new content-available field to the APNS request. This allows Hybrid and native SAP Mobile Platform iOS apps to use Remote Notifications to update data in the background via APNS.