Push Notifications

Send push notifications from your server to your customers devices. You can send a tile, toast, badge or raw push notifications. The basic step by step actions and additional setup is described in the setup section at the bottom of the page

Reference the library

C#
using CI.WSANative.Notification;

Create a push notification channel

Creates a uri which allows your sever to send push notifications to this device / user

Response will be null if the request fails - this could be due to there being no data connection

Response also indicates when the channel expires and allows you to close it manually

C#
WSANativeNotification.CreatePushNotificationChannel((response) => { });

Register push notification channel with your sever

Send the uri which was generated in the above step to your server

The uri is posted with content type x-www-form-urlencoded in the form { key:ChannelUri, value:uri }

You can leave authorisation empty if you don't want to pass a key that authenticates your app with the server, if you provide a value it will be passed as the Authorization header

C#
WSANativeNotification.SendPushNotificationUriToServer("https://www.yourserver.com", "uri", "authorisation", (success, message) => { });

Setup

Client

  1. Call WSANativeNotification.CreatePushNotificationChannel in order to get a URI which the server can use to communicate with this device / user
  2. Send this uri to the server using WSANativeNotification.SendPushNotificationUriToServer, the server should store the uri
  3. Your application should have a default tile configured, see documentation here NOTE: It is recommended that the first 2 steps be repeated each time the app starts up as the uri is only valid for 30 days

Server

  1. Register your app on dev center and have your server get an authentication token from Windows Push Notification Services (WNS). See documentation here
  2. Send out push notifications to registered devices. See documentation here