Realtime Cloud Storage
Mobile Push Notifications

  • Feb 27, 2015
  • Starting Guide

The Realtime.co Mobile Push Notifications are a great way to keep your mobile users engaged and informed about your app. It'll allow you to send notifications about content and other updates to users when they are offline. You can use the Mobile Push Notifications feature for both iOS and Android apps. For the iOS apps we’ll use the Apple Notification Service (APNS) and for Android apps we’ll use Google Cloud Messaging (GCM).

We’ve encapsulated this feature into the Realtime Cloud Storage mobile SDKs in order to make the developer’s life easier: the general idea is that when a user subscribes to a table or item event (using the .on method) using the iOS or Android SDK (stating that he wants to receive push notifications), he will be notified through a push notification when he's offline and the table or item changes (depending on the subscribed event: put, update or delete). As simple as that!

The activation process

To use the Mobile Push Notifications for both iOS and Android devices you’ll have to go through the following steps:

1- Provision your app at the APNS - Apple Notification Service platform (we’ll cover this at the next chapters);
2- Provision your app at the GCM - Google Cloud Messaging (we’ll cover this at the next chapters);
3- Register at Realtime.co and get your free Realtime.co developers license;
4- Using the Realtime.co account website enter your APNS certificate + private key and your GCM API Key;
5- Develop your iOS and Android apps using the Realtime Cloud Storage SDKs

Automatic Notifications vs Custom Notifications

The Realtime Cloud Storage servers implement an automatic publish feature where all table and item notifications are automatically pushed as mobile notifications to all the devices (users) subscribing the changed table or item. When this happen the notification alert text is set to the default string you entered at the Realtime Accounts Console (we’ll cover this in the next chapter).

We call this feature Automatic Notifications. To use them you just need to add the parameter enablePushNotifications to the .on method of TableRef or ItemRef classes (see the iOS and Android SDK reference documentation for more details).

However in some situations you’ll want to have full control over the notification text and body payload (e.g. to include a badge for iOS users). To achieve that you’ll need to use the Custom Notifications feature of the underlying Realtime Cloud Messaging service. Know more about it here.

Back to Security or proceed to Other resources

If you find this interesting please share: