Skip to content

Sample to help developers to implement Push Notification, through Azure Notification Hubs, in mobile applications.

License

Notifications You must be signed in to change notification settings

edgarclerigo/NotificationHubs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure Notification Hubs Sample

⚠️ The value provide about build status can be wrong, ignore it, for now Build Status

◻️ Table of contents

◻️ What is this?

The sample provided has the goal to help developers add Push Notifications to their applications, through Azure Notification Hubs and this sample supports the two main ways to manage devices in Azure Notification Hubs:

  • Case 1 - Devices register directly in Azure Notification Hubs
  • Case 2 - Devices register in Azure Notification Hubs through backend

◻️ Requirements

  • Create the Azure Notification Hubs in Azure Portal (Azure Mobile Service create it by default)
  • Create the required data, in Push Notification Service (WNS, GCM, APNs...), to support push notification for each Platform
  • Configure the Azure Notification Hub, in Azure Portal, with the data from Push Notification Services (WNS, GCM, APNs...)
  • Add connectiong string and hub name from the Azure Notification Hub created (in the sample it is defined in Contants.cs file)

◻️ Sample Status

  • Key: ✅ = Supported, ❌ = Not Supported, 🔧 = In development
Platform Case 1 Case 2 using WebAPI (V1) Case 2 using WebAPI (V2) Case 2 using AMS (V2)
Windows Store 8.1 (WinRT)
Windows Phone 8.1 (WinRT)
Windows Phone 8.1 (SL)
Xamarin Android
Xamarin IOS 🔧 🔧 🔧 🔧
Android Native
IOS Native

⚠️ Notes:

  1. The Case V1 was created in June 2014 following the documentation, but it changed and the Case 2 V2 was created to show the new version. At the end all version will work and for example the Azure Mobile Services will uses a solution similar to the Case 2 V1.

  2. The Windows Phone 8.0 implementation is similar to Windows Phone 8.1 SL implementation, this way it will not be provided.

  3. For Cordova apps, see the article MSDN Magazine - Push Notifications to Cordova Apps with Microsoft Azure by Glenn Gailey.

◻️ The Solution

The solution have two main cases:

  • Case 1 - Devices register directly in Azure Notification Hubs
  • Case 2 - Devices register in Azure Notification Hubs through backend

Solution showing the main folders (Case 1 and Case 2)

⚠️ The Contants.cs file should be define because it is required to the sample works.

Solution showing projects provided for Case 1 - Devices register directly in Azure Notification Hubs

Solution showing main folders for Case 2 - Devices register in Azure Notification Hubs through backends (Version V1 and V2)

Solution showing projects provided for Case 2 - Devices register in Azure Notification Hubs through backends

◻️ Screenshots

The Sceenshots folder contains image for each platform provided.

◻️ Resources

Presentation

[MSDN Documentation] (http://msdn.microsoft.com/en-us/library/jj891130.aspx)

[Curah! Azure Notification Hubs] (https://curah.microsoft.com/72603/notification-hubs)

[Azure Notification Hubs – All resources you need](http://www.saramgsilva.com/index.php/2014/azure-notification-hubs-all-resources-you-need/)

◻️ Common Issues

In General

  • The connection string from Notification Hubs is wrong;
  • The xml/json that define the template are not well defined;
  • When debug the notification is not using the correct tag or forget to use the tag;
  • Is missing the configurations in Azure Portal for each application;
  • In Azure Mobile Services developers uses the Notification Hubs API to manage devices and it is not necessary because Azure Mobile Service give us it out-of-box;
  • When developers implement the registration in devices do not use the debug feature to verify if the devices was registered correctly;
  • Developers implements the Case 1 when they want to implement the Case 2 and mixes the two cases;

In Windows (WinRT) apps:

  • In manifest should be defined the Toast capable;
  • In manifest should be defined the Internet capability;
  • Associate with store;

In Windows Phone (SL) apps:

  • In manifest should be defined Internet capability, Toast capable and the ID_CAP_PushNotification
  • Should be handled the notification when the app is running

In Android apps:

  • The Project Id is wrong;
  • The GCM component is missing;
  • In debug mode, after stop the debug be aware that is need to run again the app to receive the notifications;
  • The manifest file must have the package's name starting with lower case;
  • The key used in the payload is not the same in the application;

◻️ Tips

Push Notification Service by Platform

Platform Push Notification Service
Windows Store 8.1 (WinRT) Windows Push Notification Services (WNS)
Windows Phone 8.1 (WinRT) Windows Push Notification Services (WNS)
Windows Phone 8.1 (SL) Microsoft Push Notification Service (MPNS)
Windows Phone 8.0 (SL) Microsoft Push Notification Service (MPNS)
Android Google Cloud Service (GCM)
IOS Apple Push Notification Service (APNs)

Development In Xamarin.Android

If you are using simulator and do the deploy for install the app or debug it, you can receive Push Notification while the app run, but if you stop and try to send another Push Notification the simulator will not receive it, you should run again the app without VS to get the push notification

◻️ Build the project

To develop on this project, just clone the project to your computer, package restore is enable so build the solution first, if you get any errors try to build again and if necessary close the solution and open again to load the references.

◻️ Contributors

◻️ Contribute

Everbody is welcome to contribute, only is required to provide all cases to manage devices in Azure Notification Hubs.

Twitter hashtag : #notificationhubs

◻️ License

MIT License (MIT), read more about it in the LICENSE file.

About

Sample to help developers to implement Push Notification, through Azure Notification Hubs, in mobile applications.

http://saramgsilva.github.io/NotificationHubs/

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 85.4%
  • JavaScript 5.9%
  • PowerShell 5.5%
  • Objective-C 2.2%
  • CSS 0.8%
  • C 0.1%
  • Classic ASP 0.1%