Configure Account for Mobile Push Notifications
Mobile Push Gateway provides a method to send messages quickly and reliably via PubNub whether or not the application is in the foreground or background.
How It Works
When the Mobile Push Gateway is enabled, you may associate unique mobile devices (via their device push tokens) with PubNub channel names. Once this association is made, when a message is published to a channel that has been associated with an GCM/FCM, APNS, or MPNS device, all associated GCM/FCM, APNS, or MPNS devices will receive that message via their associated (GCM/FCM, APNS, or MPNS) native service.
Behind the scenes, the PubNub Mobile Push Gateway establishes an authenticated connection to GCM/FCM, APNS, or MPNS service providers based on your registered configuration.
Enabling Mobile Push Notifications
First step is to enable Mobile Push Notifications for your API keys in your PubNub Dashboard account.
- Login to your PubNub Dashboard
- Select the PubNub API Key (or create a new Key)
- Enable the Mobile Push Notifications add-on
Google (FCM) Push Notification Configuration
Before you can use PubNub Mobile Push Gateway with FCM, you must first setup your FCM configuration.
Google Firebase/Android Configuration Steps
- Create a Firebase Project - https://console.firebase.google.com
- Click Add Firebase to your Android app and follow the steps there
- Go to Project settings (Click the gear icon at the top left, next to Project overview)
- Click the Cloud messaging tab and find the Server key there
PubNub Dashboard FCM Configuration Steps
Once you've obtained the API Key, you are ready to configure your PubNub API keys. In the Mobile Push Notifications add-on of your PubNub API keys:
- Scroll to the Firebase Cloud Messaging section
- Add FCM API Key
- Click “Save Changes”
Apple (APNs) Push Notification Configuration
Please see the formal Apple iOS documentation on how to configure your iOS app for push notifications, in your Apple Developer account, to get the required artifacts needed to properly configure your PubNub API keys for APNs.
Apple iOS Developer App Configuration Steps
In order to use the Mobile Push Gateway and Apple's APNs, using tokens, you must have:
- A valid Auth Key file for an iOS app which the Apple Push Notification Service is enabled
- the Key ID of the Auth Key
- Your Team ID associated with the Apple Developer Account which owns the Auth Key
- All of the Bundle IDs associated with the Applications to which you will send Push notifications (often you will only be using a single Bundle ID)
- The environments associated with the Applications to which you will send Push notifications
PubNub Dashboard Steps - APNs
Once you have the required artifacts from above, you are ready to configure your PubNub API keys. In the Mobile Push Notifications add-on of your PubNub API keys:
- Click upload token file
- Navigate the file system to locate the Key file, i.e. the Auth Key file that was downloaded through the Apple Developer Program site. Click “Choose”
- Enter Team ID and Auth Key ID for the Key and Apple Developer account
- Click “Save Changes”
Now your PubNub keys are configured so that your app can send and receive Apple push notifications.