Implementing Push Notifications

Overview

Oracle E-Business Suite provides support for push notifications from Oracle E-Business Suite Mobile Foundation Release 7.0 and onwards. In order for users of the supported mobile apps to receive push notifications on their mobile devices, besides the setup tasks completed by administrators, as described in the Setting Up and Enabling Push Notifications for Oracle E-Business Suite Mobile Apps, Oracle E-Business Suite Mobile Apps Administrator's Guide, Release 12.1 and 12.2, you need to perform some tasks both on the Oracle E-Business Suite server and on the mobile client.

Important: Standard Oracle E-Business Suite mobile apps installed directly from the Apple App Store or Google Play do not support push notifications. Push notifications are supported when using Oracle Mobile Hub (OMH) or Oracle Mobile Cloud Service (MCS) in the following apps. Note that in addition to MCS, from Oracle E-Business Suite Mobile Foundation Release 9.0 and onwards, Oracle Mobile Hub provides support for push notifications through Patch 33404902:R12.FND.C for Oracle E-Business Suite 12.2, and Patch 33404902:R12.FND.B for Oracle E-Business Suite 12.1.3.

Push notifications require enterprise distribution due to iOS requirements. The provisioning profile used to build the iOS app and the certificate and private key presented by the Oracle E-Business Suite server to send the push notifications are specific to the iOS app to be used in your organization; therefore, you must obtain your own profile and certificate from the Apple Developer Program. You can then use these to build and deploy the iOS app through enterprise distribution.

For information on troubleshooting issues related to the setup or processing of push notifications, see Troubleshooting Tips for Push Notifications, Oracle E-Business Suite Mobile Apps Administrator's Guide, Release 12.1 and 12.2.

Performing Server-Side Tasks to Send Push Notifications to Mobile Apps

In order for the Oracle E-Business Suite server to send push notifications to the supported mobile apps, you must complete the following tasks:

  1. Creating Push Notification Business Events

  2. Adding the Push Notification Business Events to the Push Notification System's Event Group

  3. Sending Push Notifications to Mobile Devices

Creating Push Notification Business Events

Push notification messages are delivered to mobile devices by Oracle E-Business Suite application code through the use of business events. Each mobile app is associated with its own business event to trigger push notifications. Oracle E-Business Suite application code raises the app-specific business event based on which the Oracle E-Business Suite Mobile Foundation Push Notification System processes the notifications and delivers them to the mobile devices.

To create the push notification business event for an app, you need to log in to Oracle E-Business Suite as a user who has the Workflow Administrator Web Applications responsibility. For information on creating a business event, refer to the Oracle Workflow Developer Guide.

The business event you defined in Oracle Workflow will be used as the "Push Notification Business Event" parameter, one of the configuration parameters for the "Push Notifications" category when configuring a mobile app in the Configuration Categories region or registering the application definition metadata in the Configuration Details page through the Mobile Applications Manager responsibility.

Configuration Details Page with "Push Notification Business Event" Parameter Highlighted

the picture is described in the document text

For example, the enterprise version of the Approvals app (Oracle Mobile Approvals for Oracle E-Business Suite) uses the standard business event oracle.apps.mobile.approvals.push.event to trigger push notifications. Note that this event is already seeded and included in the seeded event group for the Push Notification System. You do not need to create the event when enabling push notifications for the enterprise-distributed Approvals app.

Adding the Push Notification Business Events to the Push Notification System's Event Group

After successfully creating the push notification business event corresponding to the supported mobile app, you need to add the newly-created event to the seeded Push Notification System's event group oracle.apps.mobile.foundation.push.group as part of the Oracle E-Business Suite Mobile Foundation Push Notification System to which all push notification business events should be added.

Note: This seeded event group already includes the app-specific standard push notification business event, such as oracle.apps.mobile.approvals.push.event for Oracle Mobile Approvals for Oracle E-Business Suite.

To add a business event to a group, you need to log in to Oracle E-Business Suite as a user who has the Workflow Administrator Web Applications responsibility. For more information, refer to the Oracle Workflow Developer Guide.

Sending Push Notifications to Mobile Devices

Oracle E-Business Suite Mobile Foundation Push Notification System provides a PL/SQL API to send push notifications to a given mobile app user. The Push Notification System identifies all the mobile devices that the user has registered to receive push notifications and then sends the same notifications to all registered devices.

For example, if a mobile user <FIRST_NAME>.<LAST_NAME> has installed an enterprise-distributed Approval app that is enabled with push notifications on two iOS devices and one Android device. All the three devices are connected to the same Oracle E-Business Suite server. If a push notification is sent to the enterprise-distributed Approvals app for the user, it is delivered to all the three devices by the Push Notification System.

The PL/SQL API signature is as follows:

procedure Send (p_event_name in VARCHAR2,
                  p_recipient in VARCHAR2,
                  p_subject in VARCHAR2,
                  p_title in VARCHAR2,
                  p_sound in VARCHAR2 default null,
                  p_badge in VARCHAR2 default null,
                  p_params in wf_parameter_list_t)

The following code snippet shows the sample usage of sending push notifications to the enterprise-distributed Approvals app:

declare
  -- Replace the text <FIRST_NAME>.<LAST_NAME> with actual recipient of Push Notification
  l_recipient_role varchar2(320) := '<FIRST_NAME>.<LAST_NAME>';
  -- Replace the number 111111 with actual notification ID
  l_nid number := 111111;

  -- Push Notification event used while registering the App in Mobile Applications 
  -- Manager. 
  l_event_name varchar2(100):= 'oracle.apps.mobile.approvals.push.event';
  l_parameterlist wf_parameter_list_t := wf_parameter_list_t();
  l_subject varchar2(1000);
  l_status varchar2(100);
    
  l_orig_lang varchar2(64); 
  l_orig_terr varchar2(64); 
  l_orig_chrs varchar2(64); 
  l_orig_date_format varchar2(64); 
  l_orig_date_language varchar2(64); 
  l_orig_calendar varchar2(64); 
  l_orig_numeric_characters varchar2(64); 
  l_orig_sort varchar2(64); 
  l_orig_currency varchar2(64); 
  l_orig_client_timezone varchar2(64);
  l_recip_lang  varchar2(64);
  l_recip_terr varchar2(100); 

begin

       select status 
       into l_status
       from wf_events 
       where name=l_event_name;
    
      if (l_status <> 'ENABLED') then 
        return; 
      end if;
      
      -- Sending translated push notification message
      -- Step 1 - Retain original NLS context 
      wf_notification_util.getNLSContext(p_nlsLanguage => l_orig_lang, 
                                         p_nlsTerritory => l_orig_terr, 
                                         p_nlsCode => l_orig_chrs, 
                                         p_nlsDateFormat => l_orig_date_format, 
                                         p_nlsDateLanguage => l_orig_date_language, 
                                         p_nlsNumericCharacters => l_orig_numeric_characters, 
                                         p_nlsSort => l_orig_sort, 
                                         p_nlsCalendar => l_orig_calendar,
                                                                                                                 p_clientTimezone => l_orig_client_timezone);

      -- Find out mobile user's device language and territory preference
      l_recip_lang := fnd_mbl_notification.GetDeviceLang(l_recipient_role, l_event_name); 
      l_recip_terr := fnd_mbl_notification.GetDeviceTerr(l_recipient_role, l_event_name); 
          
      -- Set NLS context to that of the push notification recipient. Only  language and
      -- territory are available from device registration, for rest of the NLS context,leave it to DB default    
      wf_notification_util.SetNLSContext(p_nlsLanguage => l_recip_lang,
                                         p_nlsTerritory => l_recip_terr);
                                                                                 
      -- Get subject in recipient's NLS context          
      l_subject := wf_notification.GetSubject(l_nid, 'text/html');
                 
      -- Reset to original NLS context 
      wf_notification_util.SetNLSContext(p_nlsLanguage => l_orig_lang, 
                                         p_nlsTerritory => l_orig_terr, 
                                         p_nlsDateFormat => l_orig_date_format, 
                                         p_nlsDateLanguage => l_orig_date_language, 
                                         p_nlsNumericCharacters => l_orig_numeric_characters, 
                                         p_nlsSort => l_orig_sort, 
                                         p_nlsCalendar => l_orig_calendar,
                                                                                                                 p_clientTimezone => l_orig_client_timezone);
                                        
      wf_event.AddParameterToList('WF_NOTIFICATION_ID', to_char(l_nid), l_parameterlist);
      fnd_mbl_notification.Send(p_event_name => l_event_name, 
                                p_recipient => l_recipient_role, 
                                p_subject => l_subject,
                                p_title => null,
                                p_params => l_parameterlist);
end;
/
commit;

Note: In this sample code, the NLS context is changed to the language of the mobile app user's device locale to translate the message. If the mobile app user's language is not supported by Oracle E-Business Suite, then the message is sent in the base language.

Sending Notification Identifier

When a push notification is sent to a mobile device, in addition to displaying the notification subject shown as the message to the mobile user, you can send internal values regarding that specific notification that can be used by the mobile app code for further processing. For example:

Performing Client-Side Tasks to Receive Push Notifications in Mobile Apps

In order for Oracle E-Business Suite mobile apps to receive push notifications, you must complete the following tasks on the mobile client:

  1. Enabling the Push Plug-in

  2. Migrating to Firebase Cloud Messaging (Android Only)

  3. Handling Push Notifications (Optional)

Enabling the Push Plug-in

Push notifications are currently supported when using Oracle Mobile Hub (OMH) from Release 9.0 and onwards with a patch applied or using Oracle Mobile Cloud Service (MCS) for custom mobile apps developed using Oracle E-Business Mobile Foundation as well as for the Approvals app when provided to users through enterprise distribution.

For information about the patch of using Oracle Mobile Hub from Oracle E-Business Suite Mobile Foundation Release 9.0, see Implementing Push Notifications.

To allow these mobile apps to receive push notifications on the mobile devices, you should enable the Push plug-in for the corresponding Mobile Application Framework (MAF) project.

Instructions to Enable the Push Plug-in

After you have created the MAF project for your mobile app, perform the following tasks to enable the Push plug-in:

  1. Open Oracle JDeveloper.

  2. In the Applications Navigator, expand the Application Resources panel, then the Descriptors folder, and then the ADF META-INF folder.

    Double-click the maf-application.xml file to open the overview editor for the maf-application.xml file.

  3. Select the Plugins navigation tab.

  4. In the Core Plugins region, select the PushPlugin check box to enable the Push plug-in.

    Note: The PushPlugin check box is unselected by default in the Mobile Application Archive (MAA) file.

    Plugins Tab: Core Plugins Region with PushPlugin Selected

    the picture is described in the document text

  5. Save your work.

    This enables the MAF application to first register for push notifications with Oracle E-Business Suite and then receive push notifications.

Migrating to Firebase Cloud Messaging (Android Only)

For push notifications on Android, Oracle E-Business Suite mobile apps use Firebase Cloud Messaging (FCM) to replace Google Cloud Messaging (GCM), which has been deprecated by Google. To migrate to FCM, follow the instructions provided by Google at https://developers.google.com/cloud-messaging/android/android-migrate-fcm. After completing the migration or creating a new FCM app, download the generated google-services.json file to the root directory of your mobile app (parallel to the ViewController and ApplicationController directories), as demonstrated by the following example.

MAFappRootDirectory
  MAFapp.jws
  ApplicationController
  ViewController
  google-services.json
  ....

This completes the migration of your Oracle E-Business Suite mobile apps to use FCM.

Handling Push Notifications (Optional)

When a push notification arrives on a mobile device, the mobile device's user can view the notifications in the notification center. When the user selects the notification from the notification center, the device opens the mobile app corresponding to that notification. When the mobile app is launched through a selection of a push notification, instead of launching the app in a regular way through the landing page, you can optionally choose to perform some notification handling tasks to let the app directly launch the mobile app page where it displays the appropriate details corresponding to that push notification.

Take an enterprise-distributed Approvals app as an example. A manager receives a push notification "Expense Report W1234 for $500.00 is submitted for approval". When the manager selects that notification from the notification center, the Approvals app displays the Expense Report approval notification details. If you choose not to handle the notifications, the app will be launched normally by taking the user to the regular landing page.

Although handling push notifications is an optional task, from the user experience perspective, it is important for a user to quickly navigate to an appropriate page to obtain the message details when the app is launched through a push notification.

Instructions to Handle Push Notifications

Perform the following tasks to allow your mobile app to handle the push notifications and guide the app users to an appropriate mobile page:

Note: Oracle E-Business Suite mobile apps that implement push notifications using enterprise distribution from the associated MAA files have already completed this optional task. The instructions described here only apply for the custom smartphone apps.

Note: Push notifications cannot be tested in iOS simulator or Android emulator. Instead, you need to install the app on a mobile device to test push notifications.