问题
I have a metro application in which am trying to display notifications whenever my service get updated.I tried to read Metro App push notification concepts overview from microsoft website and I observed Push Notifications sample but I did not get proper idea to implement push-notifications in Metro-apps?
Can anyone give me a sample example to implement push notifications in metro apps using HTML5 & JavaScript,really it will helpful to me?
Thank you in advance.
回答1:
For push notifications, you need a server side component to perform the actual push of the notification. This is performed by your server sending a request to a specific URL -- that URL is obtained from your application which registers with your service. Clearly doing this in a pre-canned way is marginally non-trivial, although the process itself is not.
Details on how to obtain the URL, and how to send a notification to it:
- http://msdn.microsoft.com/en-us/library/windows/apps/hh465412.aspx (Getting the URL)
- http://msdn.microsoft.com/en-us/library/windows/apps/hh465450.aspx (Sending a notification to the URI)
If, however, you just want to update the tile for your application when it does something when the user is using it:
http://msdn.microsoft.com/en-us/library/windows/apps/hh465439.aspx is a good starting point.
The above links have snippets. There is a fully worked through sample for tiles/notifications on MSDN also: http://code.msdn.microsoft.com/windowsapps/Push-and-periodic-de225603 (Push) http://code.msdn.microsoft.com/windowsapps/App-tiles-and-badges-sample-5fc49148 (Local)
回答2:
I'm also working on the same. Here I'm sharing few links below which might be useful to you.
Prior to this, once read the Guidelines and Checklist for implementing push notifications.
Go through this link for Implementing Windows 8 Push Notifications.
Hope it Helps.
来源:https://stackoverflow.com/questions/11827357/windows8-push-notifications-in-metro-application-using-html5