Push to Android, iOS, WP8 and FFOS - All at Once with AeroGear
November 24, 2014
Supported Push Networks
AeroGear UnifiedPush Server is extremely useful in situations where you want a single server responsible for managing and watching over push notifications sent to multiple platforms. UnifiedPush server supports as of today…
-
iOS (APNS)
-
Android (GCM)
-
Windows Phone (WPS, MPNS*)
-
Firefox OS (Simple Push)
*) MPNS is already developed, but not released yet
Building Whats Up? chat application in < 20 minutes
I believe there is never enough chat applications available in mobile app stores, so I decided to build a small Push Notifications based message exchange app. ;-)
In the following screenshare I will take you from initializing new application to the deployment and use on actual mobile devices, all that in less than 20 minutes!
The summary of the highlighted steps follows:
Cordova + Ionic
In order to start a new app, one has to just:
ionic start myapp blank
Then, you can add support to all required platforms:
cordova platform add android ios wp8 firefoxos
(Note that you will actually need at least two operating systems to build the project locally - I used virtualized environment.)
Installing Cordova Push Plugin
And don’t forget to register a UnifiedPush plugin:
cordova plugin install org.jboss.aerogear.cordova.push
Let’s create a push-config.json
(*) and populate it with the definitions for all variants that you:
*) push-config.json is another sneak peak - feature that is developed but not released yet
{ pushServerURL: "http://myapp-mydomain.rhcloud.com/ag-push/", android: { senderID: "315466463870", variantID: "988971c5-82c8-4232-91a2-083394addf29", variantSecret: "8283a07f-0736-4205-b6e9-ac7e1eea29c0" }, ios: { variantID: "8d4adf84-12a7-405f-8489-399baaf2d995", variantSecret: "2f77047c-e420-44da-945c-b7d8d5280a36" }, firefoxos: { variantID: "5c328ffd-7157-40df-9ac3-1758837fb911", variantSecret: "baa74aad-d8e5-4069-a66a-970a4db399c1" }, windows: { variantID: "b3ddb379-9397-4753-86d7-d667c13df341", variantSecret: "9787773a-938b-4334-bf89-f17a13c2665b" } }
Finally, you need to register for receiving Push Notifications by invoking the plugin API and providing 3 handlers:
push.register( onNotification, successHandler, errorHandler );
I can’t imagine there could be anything simpler for cross-platform mobile development than Cordova and cross-platform Push Notifications than UnifiedPush Server.
You can find a complete guide to setting everything up in AeroGear Cordova Push Plugin documentation.