简体   繁体   中英

Azure Push notifications without Azure Mobile project?

I'm building a Phonegap application that uses a server backend built with .net MVC 5 & Web API2. It's hosted on Azure cloud services and all is working well.

I now need to add some functionality to send push notifications when certain events happen. I've set up a Mobile Service on Azure and configured it for IOS (I will add Android when I have it working) and I now need to start coding the functionality.

I was planning on storing the device registration Id in my own Database and writing a simple class/service that consumes the Azure Mobile Services API to send the push notification. I've spent the last few hours reading up on this and all of the tutorials involve creating a new Azure Mobile Services project which uses Azure Table storage and configuring that ( https://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn629482.aspx ).

I'd like to avoid this as it seems like overkill and it's yet another thing I'll need to deploy and manage.

Does anyone know if it is it possible to just add the required references to my existing cloud services project and do it the way I proposed?

Many thanks, John

Since you already have a working backend, you don't need a Mobile Service just to send Push Notifications. Take a look at Azure Notification Hubs. You can call it via REST from your MVC, or use the Azure Service Bus NuGet package.

Take a look at this introduction: Get started with Notification Hubs

Note that you will need two different Notification Hubs, one with the sandbox APNs certificate for use with Xcode development builds, and one with the production APNs certificate for release and ad-hoc builds. If you don't have a separate instance of your MVC service for development, you will have to keep the device registrations straight somehow between the two.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM