Guidelines for push notifications
Push notifications are sent from a cloud server to update your app's live tile or send toast notifications.This topic provides general and coding guidelines for using push notifications in your Windows Store app.
The push delivery method allows users to receive notifications from your app at any time, even when the app isn't running.
Push notifications are an excellent option if you want your app to share:
- real-time updates (like sports scores during the game)
- content that's generated at unpredictable times (such as breaking news, incoming emails, or social media updates)
For a comparison of the four delivery methods (local, scheduled, push, and periodic) available for Windows Store apps, see Choose a notification delivery method.
- Follow the general tile and toast notification guidelines. Whether a tile or toast notification is generated locally or through the cloud, it should respect the same user guidelines. For more information, see these topics:
- Respect your user's battery life. Users can receive notifications at any time, even when their device is in a low power state. The more notifications that you send, the more resources it will require and the more frequently you will wake up the device. Keep this in mind when you determine the frequency of your notifications.
- Choose the lowest frequency of notifications that still delivers a great user experience. Increasing the frequency of notifications doesn't necessarily increase the value of your app. For example, if your tile content is updated too frequently, some of your updates will never be seen by the user.
- Don't send confidential or sensitive data through push notifications. For example, a bank account number or password should never be sent in a notification.
- Don't use Windows Push Notification Services (WNS) to send critical notifications. Although WNS is reliable, the delivery of notifications isn't guaranteed.
- Don't use push notifications for ads or spam. WNS reserves the right to protect its users and, if an app's use of notifications is deemed inappropriate, the service can block the app from using push notifications. If users report that an app is exhibiting malicious intent, that app may be subjected to Windows Store removal policies.
- Register your app in the Dashboard to use WNS. Your app server has to use the specific credentials provided by the Dashboard to authenticate and send notifications.
- Request a channel each time the app launches. Channel URLs can expire and are not guaranteed to remain the same each time you request one. If the returned channel URL is different than the URL that you had been using, update your reference in your app server.
- Validate that the channel URL is from WNS. Never attempt to push a notification to a service that isn't WNS. Ensure that your channel URLs use the domain "notify.windows.com" (Windows or Windows Phone) or "s.notify.live.net" (Windows Phone-only).
- Always secure your channel registration callback to your app server. When your app receives its channel URL and sends it to your app server, it should send that information securely. Authenticate and encrypt the mechanism used to receive and send channel URLs.
- Send both the channel URL and device ID to your app server, so that the app server can track to which devices the URLs are assigned. If a URL changes, then the app server can replace the old URL associated with that device ID.
- Reuse your access token. Because your access token can be used to send multiple notifications, your server should cache the access token so that it doesn't have to reauthenticate each time it wants to send a notification. If the token has expired, your app server will receive an error and you should authenticate your app server and retry the notification.
- Don't share your Package Security Identifier (PKSID) and secret key with anyone. Store these credentials on your app server in a secure manner. If you believe that your secret key has been compromised, generate a new key. Routinely generate a new secret key to present villains with a moving target.
- For designers
- Windows Push Notification Services (WNS) overview
- Choose a notification delivery method
- For developers (XAML)
- Sending push notifications with WNS
- Quickstart: Sending a push notification
- For developers (HTML)
- Sending push notifications with WNS
- Push and periodic notifications client-side sample