当应用程序未运行时,如何处理Windows Phone 7上的Toast通知? [英] How can I handle toast notifications on Windows Phone 7 when application is not running?

查看:144
本文介绍了当应用程序未运行时,如何处理Windows Phone 7上的Toast通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Toast讯息是

 string ToastPushXML = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
            "<wp:Notification xmlns:wp=\"WPNotification\">" + "<wp:Toast>" + "<wp:Text1>{0}</wp:Text1>" +
            "<wp:Text2>{1}</wp:Text2>" + "<wp:Param>{2}</wp:Param>" + "</wp:Toast>" + "</wp:Notification>";

在我的应用程序运行时,我可以在ShellToastNotificationReceived上接收我的自定义参数(wp:myCustomParam1等)对象发送者,NotificationEventArgs e)事件处理程序作为e.Collection中的键

While my app is running I can receive my custom parameters (wp:myCustomParam1 and other) on ShellToastNotificationReceived(object sender, NotificationEventArgs e) event handler as keys in e.Collection

但是当我的应用程序没有运行和通知来了,用户点击弹出通知和应用程序启动,ShellToastNotificationReceived不调用和通知丢失。

But when my app is not running and notification comes, the user taps on pop-up notification and app started, the ShellToastNotificationReceived doesn't calls and notification is lost.

那么,在这种情况下如何获得我的自定义参数?

So, how can I get my custom parameters in this case?

推荐答案

虽然参数在这种情况下不可用,但我相信这个领域的预期行为是,用户启动应用程序。一旦应用程序(重新)启动,它将向服务器请求获得所需的最新信息。自从应用程序上次启动以来,可能已经发送了任何数量的吐司,或者应用程序可能正在使用交际时间机制,在半夜(或等同)发送吐司,所以任何数量的通知也可能没有

While the parameter is not available in this scenario, I believe the intended behaviour in this area was that the toast would drive the user to start the app. Once the app is (re)started it would make a request to the server to get the latest information it needs. There could have been any number of toasts sent since the app was last launched or the app may be using a "sociable hours" mechanism to not send toasts in the middle of the night (or equivalent) so any number of notifications may also have not been sent.

有效载荷中的 param 参数仅在接收到通知时使用app正在运行。在这种情况下,参数是保存另一个回程到服务器的更多信息。

The param parameter in the payload is intended to be used only when the notification is received when the app is running. In this scenario the parameter is there to save another round trip back to the server for more information.

用户的文本。 param 适用于应用程序。期望的是,在任何一个通知中,最多只有一个相关/使用。文本是为用户在不使用应用程序,并告诉他们可能希望他们打开应用程序。

The text is there for the user. The param is there for the app. The expectation is that, at most, only one will be relevant/used in any one notification. The text is there for the user when not using the app and to tell them something that may want them open the app.

这篇关于当应用程序未运行时,如何处理Windows Phone 7上的Toast通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆