Use Azure to Send Push Notifications to Visual Studio Cordova Apps

imageGreetings to all…I hope that all of you had as successful an end to 2014 as I did. It’s now 2015, and I am excited to share with you the news that I have expanded my previous blog post Push Notifications to PhoneGap Apps using Notification Hubs Integration (on the old Azure Mobile Services team blog) into a full-fledged article for a special connect() edition of MSDN Magazine, titled: Push Notifications to Cordova Apps with Microsoft Azure.

I encourage everyone who needs to send push notifications to their Apache Cordova (or PhoneGap) apps to check out this article. Unlike my previous post (which relied on a custom set of APIs that I wrote), this new article features both the new Azure Notification Hubs integration in a new Mobile Services plugin and the new Apache Cordova tooling for Visual Studio. (Note that the Mobile Services plugin only supports push notifications on iOS and Android platforms—if you need to also support Windows Phone, you will need to stick with my previous post.) My new article focuses on the Android platform, but you can do the same for iOS. The sample project for the article supports both.

This issue also has another great Cordova article Write Cross-Platform Hybrid Apps in Visual Studio with Apache Cordova, penned by my coworkers Kraig Brockschmidt and Mike Jones, which is a primer for leveraging the new Apache Cordova tools support provided by Visual Studio. (You should definitely read this one before you read mine on push notifications.)

Visual Studio for Apache Cordova Appsimage

As you can see in Kraig's and Mike's article, Visual Studio has really put a lot of effort towards providing a first-class tooling experience when creating cross-platform apps using Cordova.  

The push notification support for Cordova is not yet quite as “turn-key” as it is for Windows apps, but I hear that’s a goal for future releases. In the meantime, my article shows that Visual Studio still works pretty when configuring push notifications for Cordova apps.

Push Support for the Mobile Services Plugin

The Mobile Services team did a great job of publishing (on fairly short notice) a new Cordova plugin for Mobile Services that supports the ability to register for push notifications from the client (without having to use REST). Thanks Phil! My article leverages this new plugin for registration, and as I already mentioned, the process is all pretty easy to do from Visual Studio—in fact, by far the worst part of the whole process is provisioning with the platform notification service (GCM or APNS).

(Note that the folks at MS Open Tech were the ones who produced the original plugin for Mobile Services, but this original plugin doesn’t include support for push notifications. Although the Visual Studio tools uses the original MS Open Tech version of the plugin by default, I would always switch over to using the new plugin even when not doing push notifications, just to have the latest bits.)

Hope you enjoy the new MSDN Magazine article—if you have questions or comments, please feel free to ask them here, in the sample repo, or on Twitter.

 

Cheers!

Glenn Gailey