Binding a Mobile Client with the Push Notifications service

Prerequisites

Android
  • A Google account

  • Access to the Firebase console. See Firebase Setup to get started.

iOS
  • An Apple Developer account

  • An APNs client TLS certificate. Have a look at APNs Setup for further instructions.

To use mobile services, you must represent your mobile app in OpenShift using a Mobile Client, and that Mobile Client must be associated with the mobile service. This association is called binding and once it’s done, your mobile app can use that service immediately.

The association between a Mobile Client and Push Notifications Service uses the Service Broker bind feature.

To associate a Mobile Client with a mobile service:

Procedure

  1. Navigate to the Overview of your OpenShift project.

  2. Click on the Mobile Client and navigate to Mobile Client view.

    Your mobile app will be represented by two items in OpenShift, an item in the Mobile Clients list and an item in the Provisioned Services list. Make sure to click on the item in the Mobile Clients list.
  3. Navigate to Mobile Services tab.

    mobile clients services all unprovisioned
  4. Click Create Binding and follow the Create Binding wizard to associate the Mobile Client with the Push Notifications Service.

  5. Fill out the binding parameters required by the Push Notifications Service.

When you bind a mobile client to the Push Notifications service, a variant is created to store the credentials required to communicate with a push network. Those credentials need to be provided in the binding dialog.

First pick your Mobile Client Type. Depending on the selection you then have to fill out the fields for either Android or iOS.

Android

You need to provide a Server Key and a Sender ID. Both can be found in the Firebase console under Project Settings > Cloud Messaging. Make sure that you have selected Android in the Mobile Client Type dropdown.

iOS

You need an APNs client TLS certificate. Have a look at APNs Setup for instructions on how to obtain one. Make sure that you have selected iOS in the Mobile Client Type dropdown. The certificate needs to be encoded in base64 before copying it into the field labelled iOS .p12 file. If you’re on Mac OS run:

cat <path/to/your/.p12> | base64

If you’re on Linux chances are that you’re using a version of the base64 tool that does line wrapping. You need to disable this:

cat <path/to/your/.p12> | base64 --wrap=0

After clicking Bind your variant will be created in UPS and you should see a new binding for your mobile client.