This is a multi part blog post the other posts in this series are:
- Overview – you’re reading this now.
- The push notification service – how to implement the delayed push notification service
- The client library – not yet written.
Push notifications are a web service that MS provides that can send a message to the phone. There are 3 flavors of push notifications:
- Raw notification: Raw bytes - ignored if your app isn't running, sent to your app if it's running.
- Tile notification: Manipulate application tile, worth it's own blog post.
- Toast notifications: If your app isn't running pop up a toast giving a message to the user.
// doesn't work like this.
proxy = CreateProxy("http://well-known-push-notification-service")
proxy.push-toast(id-for-running-app-phone-taken-from-phone, "toast text")
proxy.push-toast(id-for-running-app-phone-taken-from-phone, "toast text2")
// works like this.An annoying limitiation of push notifications is you can't schedule them at arbitrary times. From MSDN:
proxy = CreateProxy(id-for-running-app-phone-taken-from-phone-with-built-in-service-url)
proxy.push-toast("toast text") // no need to specify phone/app id
proxy.push-toast("toast text2") // no need to specify phone/app id
sendNotificationRequest.Headers.Add("X-NotificationClass", "As a result I decided to write a simple web service which will allow you to send your app push notifications. The sequence diagram for this service is:");
// Possible batching interval values:
// 3: The message is delivered by the Push Notification Service immediately.
// 13: The message is delivered by the Push Notification Service within 450 seconds.
// 23: The message is delivered by the Push Notification Service within 900 seconds.
The API for this web service is:
http://{root}/push-toastIf you want to use this web service you can ping me and I'll give you access. In future blog posts I'll talk about the code for the web service as well as the client library. Leave a comment if you'd like to use this service and we can talk about whatever features you require.
POST a query string with the following parameters:
{'url:'push notification url',
'message':'text of the toast'
'seconds':'time delay in seconds'
}
RETURN: a json object with:
{
'key' : 'an opaque value used when requesting the toast be cancelled '
'secret' : 'an opaque value used when requesting the toast be cancelled '
}
http://{root}/cancel-push
POST a query string with the following parameters:
{
'key' : 'an opaque value returned from post'
'secret' : 'an opaque value returned from post'
}
RETURN: not defined
0 comments:
Post a Comment