Oracle Mobile Cloud Service


diagram of Notifications within MCS architecture

You can use the Notifications service to send notifications to users of the apps registered in a mobile backend. Once you have the mobile backend set up for notifications, the process of sending the notifications is the same for both iOS and Android apps.

You set up notifications by obtaining the appropriate vendor certificates and registering them with the app's mobile backend. In addition, you include some code in the app itself to enable it to receive notifications. The notifications themselves can be sent via a third-party server or be triggered by logic in a custom API.

described in surrounding text

Note: Before you start, complete the Get Started with Mobile Development tutorial that is offered within Oracle Mobile Cloud Service on its Home page. That tutorial provides the mobile backend and the quickstart project that you will use here.

part 1 Set your application up with your platform vendor

Notifications are sent through the networks provided by your vendor, so you need to do your initial setup with Apple (for iOS apps) and Google (for Android apps).


To send notifications to iOS apps, you need a provider certificate from Apple (in addition to the certificate used to set up your account).

  1. Log in to the Apple Developer Center ( using your Apple Developer account.
  2. If you haven't yet enabled notifications for your app ID, go back and enable it now.
  3. Create a Certificate Signing Request (CSR) file for the app ID, install it on your Mac, and make sure you convert it to a.p12 file so you can upload it to MCS.


To enable Notifications from the Google Network side, you need to have a project ID, Google Cloud Messaging (GCM) enabled, and an API key.

  1. Go to the Google Developer's Console ( and navigate to your project (or create a new project).
  2. Make a note of the project ID and project name.
  3. Click the menu icon next to the Google label and select API Manager
  4. Click the Google Cloud Messaging link for Android.
  5. Click Enable API.
  6. In the left navbar, select Credentials.
  7. Click Add Credentials, select API Key, and then click Server key.
  8. Type a name for the key and click Create.
  9. Make a note of the generated key.

part 2Create a notifications profile and register the client app

Next you go back to MCS to handle the following tasks:

  • Create a notifications profile to store the vendor credentials.
  • Register the app in MCS as a client and associate the notifications profile with the client.
  • Associate the client with your mobile backend.

Here are the concrete steps:

  1. Click menu icon in the upper left corner of the page and select Applications > Client Management.
  2. In the left navigation bar, click Client Management.
  3. Click Profiles.
  4. In the New Profile dialog:
    1. Fill in the Name. This can be whatever name that will help you identify the profile most easily.
    2. Select the Notification Service.
    3. Fill in the rest of the dialog with the information required by the notification service.

      For Apple Push Notification Services (APNS), select Development or Production and then upload your secure certificate.

      For Google Cloud Messaging (GCM), fill in the server credentials you obtained from the Google Developer's Console. (You only need to provide the package name if the credentials are scoped to the specific app you are working with in this tutorial.)

    4. Click Create to create the profile and close the dialog.
  5. Click Clients.
  6. Click New Client.
  7. In the New Client dialog:
    1. Fill in the Client Display Name and Client Name. (These can be whatever names that will help you identify the client most easily. The former can have spaces and the latter can’t.)
    2. Select the Platform.
    3. Fill in the Version Number field.

      This version must match the version number of the app as registered with your platform vendor.

    4. Fill in the fully-qualified app ID. This app ID must match what you specified in the notifications profile.

      For Apple, it is the Bundle ID assigned to the application in the Xcode project.

      For Google, it is the Package Name for the application as declared in its manifest file.

    5. Click Create.
  8. Make a note of the value of the Application Key that is shown in the Settings page. You'll later need to add this key to the app's configuration file.
  9. From the Mobile Backend dropdown, select a mobile backend to associate with the client.
  10. Click the Profiles tab and select the notifications profile that you created earlier.

part 3 Prepare the client application to receive notifications

You need to configure your app so it can use the device provider’s network for notifications. Here are the steps for iOS and Android.


As an iOS developer, you need to add some code to get a device token and register your mobile application for notifications.

Code has been added to the sample project to handle these tasks. You just need to uncomment it.

In the appDelegate.m file, look for the following snippet and delete it:

    // Begin commented out Notifications code.

Then delete the closing of the comment.

    // End commented out Notifications code.

Then, in the LoginViewController.m file, look for the following line and uncomment it.

//[self registerForPushNotifications];

You also need to update the OMC.plist file with the client's application key:

  • In the OMC.plist file, locate the appkey key and replace the value in its corresponding <string> element with with the application key that was generated when you registered the app as a client in MCS.


In your client application's main/AndroidManifest.xml file, within the <application> tag just before the closing </application>, register the service and any broadcast receivers for the Notifications service, as shown below. Substitute your app's package name for YOUR.PACKAGE.NAME.

    <service android:name=""
			android:exported="false" />
    <receiver android:name=""
           <action android:name="" />
           <action android:name="" />
           <category android:name="YOUR.PACKAGE.NAME" />

Set permissions to receive and display notifications by inserting these entries in the Android manifest (somewhere above the <application> entry). Substitute your app's package name for YOUR.PACKAGE.NAME.

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <permission android:protectionLevel="signature"
            android:name=YOUR.PACKAGE.NAME.permission.C2D_MESSAGE" />
    <uses-permission android:name="YOUR.PACKAGE.NAME.permission.C2D_MESSAGE" />

Then, in main/java/example/com/gettingstartedandroid/, scroll to the line:

private final String PROJECT_ID = "YOUR_PROJECT_ID";

Replace YOUR_PROJECT_ID with the project ID that you obtained from the Google Developer's Console.

Then scroll to the registerNotificationClient() method to see the code for registering the device for receiving notifications.

    private void registerNotificationClient(){
        try {
            mNotification = MobileBackendManager.getManager().getDefaultMobileBackend(this).getServiceProxy(Notifications.class);
            mNotification.initialize(this, PROJECT_ID);
        } catch (ServiceProxyException e) {

Next you need to have your app reference the client's application key:

  1. In the app's oracle_mobile_cloud_config.xml file, insert the following element below the <baseUrl> element:

  2. Within that element, insert the application key that was generated when you registered the app as a client in MCS.

part 4Build and deploy the updated application

  1. In your IDE, run the application.

    The IDE should build the application and then launch it in an emulator, simulator, or device of your choosing.

  2. In the running app, click Sign In, and enter the username and password.

part 5 Send the notification

Now let’s go into the Oracle Mobile Cloud Service user interface and send a notification from there.

  1. Click menu icon in the upper left corner of the page and select Applications > Mobile Backends.
  2. Select the your mobile backend and click Open.
  3. In the left navbar, select Notifications.
  4. Click the Send icon.
  5. On the Send Notifications page, type a message and click Send.
  6. Check the emulator to see if you have received the message.

part 6Next steps