WP7 Push Notification

1. OverView.

http://msdn.microsoft.com/en-us/library/ff402558(v=vs.92).aspx

2. Setting up a authenticated web service to send push notifications

http://msdn.microsoft.com/en-us/library/ff941099(v=vs.92).aspx

注:

接收消息:

1.tile notification 默认是通知Application tile的,如果是要指定到secondary tiles的话,需要指定ID的.

2.如果是用本地资源的话 BindToShellTile() 如果是远程资源的话,需要 BindToShellTile(Collection<Uri>) 来指定可达到的域名(256字符限制)。

3.如果使用 raw notification 的话,需要注册HttpNotificationReceived 事件来处理原生数据,而且他只会在程序运行的时候触发的。

4.如果使用 toast nofication的话,在运行时默认是忽略掉的,如果要调用的话,先要注册 ShellToastNotificationReceived 事件

5.每次启动程序时,应该将 Push uri发送到 web service中,这样的话如果更新的话,就可以替换下。而且最好是将设备ID也一起发送,便于统计数据。

6.push uri应该加密的,否则被截获就惨淡了。

7.toast notification的 param 和 tile notification 的 backtile backBackgoundImage BackContent 和ID 是在 7.1中才有的,如果是7.0就会出错,因此发送的时候考虑上传系统版本号。

8.ConnectionStatusChanged 可以用来监测连接状态

9.应该给用户提供 Push开关,而且用户关闭的时候也要调用 Close方法的。

10. 各种接收错误:http://msdn.microsoft.com/en-us/library/hh202940(v=vs.92).aspx

 

发送消息:

1.一个消息只能发送一个通知,不管是那个类型或者是混合的。

2.消息是发送到  Microsoft Push Notification Service 的,不是手机,然后 MPNS会返回是否收到,但是不能确定手机是否收到。

3.row notification 3种参数

   1)/page1.xaml – Defines the page to navigate to in the application when it is started. It must begin with a “/”.

   2)/page1.xaml?value1=1234 &amp;value2=9876 – Defines the page to navigate to when the application is started, along with name/value     pairs of information. It must begin with a “/”.

   3)?value1=1234 &amp;value2=9876 – Contains name/value pairs of information passed to the default start page of the application. It       must begin with a “?”.

4.类型是在Header中指定的,而且也可以设置延迟触发的时间

5.可以通过Action来清空tile,Backgound除外。

6.MSDN的Samples是有问题的,用的Encoding.Default,中文默认是有错的,因此要改成Encoding.UTF-8

posted @ 2012-01-17 15:54  jeekun  阅读(1267)  评论(4编辑  收藏  举报