Xamarin & Azure Notification Hubs
A few weeks back the Azure Dublin user group hosted some of the Microsoft and Xamarins team in Dublin for a half day conference. While the Microsoft & Xamarin teams were there to cover some introductory sessions on using Xamarin, they also invited some industry partners to talk about some other technical topics. I presented a quick 15 minute intro on how to use the Azure Notification Hubs platform for sending push notifications to the various platform specific notification services for each of the major mobile platforms.
Azure Notification Hubs is the Microsoft Azure scaled-out infrastructure for doing multi-platform push-notifications. It provides you with a single single hosted platform which you can configure to relay your push notifications to all the major platform specific push notification services.
Currently, Azure Notification Hubs supports sending notifications to
- Windows Notification Service (WNS) for Windows Phone & Universal Apps on Windows 8 and Window 10
- The legacy Microsoft Push Notification Service (MPNS) for older Windows Phone 8 apps
- Apple Push Notification Service (APNS) for Apple Devices such as IPhones and Macs running iOS and OSX
- Firebase Cloud Messaging (FCM) and Google Cloud Messaging (GCM) for Android devices & chrome apps
- Baidu Cloud Push for Android in China
- Amazon Device Messaging (ADM) for Amazon Kindles
Setup can be a little tricky for the respective platforms. In order to configure Google for example, you'll need to login to the Google Developer Console and enable the FireBase/Google Cloud Messaging API, recording your API Key. You'll also need to configure a project under the IAM & Admin Sections and take note of your Project Number which will be used in your source code
Apple's Push Notification Service on the other hand requires that you generate a CSR which is uploaded to the Apple Developer site. That will allow you to create a Certificate which is in turn uploaded to the Azure Notification Hub configuration.
Once you've configured the various platform notification services in Azure, you can start pushing notifications out to various subsets of your user base. Notification Hub clients support connecting with Tag configurations. This allows you to dynamically tag your client base by device, demographic, specific user or some other categorisation and then targets those subsets of users
You'll find some demo code to get you started in our demo repository of Source Code on Github and a copy of the presentation slides from the demostration below