应用程序中收到的 WP7 推送通知

发布于 2024-12-17 04:45:59 字数 385 浏览 1 评论 0原文

我想知道当我的应用程序关闭时发送通知时,是否可以在我的代码中的 wp7 上接收 toast 推送通知(或任何与此相关的推送通知)。例如。现在,我有一个演示应用程序,每次向应用程序发送 toast 通知时,该应用程序都会增加一个数字。当应用程序运行时,这工作得很好,但是如果我关闭应用程序并发送 toast 通知,顶部的通知行会显示(正如它应该的那样),并且当我单击它时,数字不会更新。换句话说,我希望我的channel.ShellToastNotificationReceived 在收到通知后、再次打开应用程序时运行,我想知道这是否可能?

作为替代方案,这是不可行的吗?是否可以在收到 Toast 通知时运行一小段代码?例如,创建一个后台代理或类似的东西,每当我的应用程序收到推送通知的 toast(或原始,或任何其他类型)时就会调用它?

I'm wondering if it's possible to receive toast push-notifications (or any push-notification for that matter) on wp7 in my code when the notification was sent when my application was closed. For example. Right now I have a demo-application that increments a number every time I send a toast-notification to the application. While the application is running, this works perfectly, but if I close the app and send a toast-notification the notification-line on top shows (as it should), and when I click it the number doesn't get updated. In other words, I would like my channel.ShellToastNotificationReceived to be run after I've received notifications, when the application is once again opened, and I'm wondering if this is possible?

As an alternative, is this is not doable, is it possible to get a small piece of code to run whenever I receive a toast notification? Like, create a background agent or something like that that gets called whenever my application receives a toast (or raw, or any other type for that matter) of push-notification?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

万人眼中万个我 2024-12-24 04:45:59

如果没有任何用户操作,则无法远程启动您的应用程序。

但就您而言,您可以轻松地弥补这一点:让应用程序请求数据。应用程序只需在启动时向服务器询问最新的值即可。然后它就可以像收到推送通知一样运行。

There is no way to start your app remotely without any user action.

But in your case you can easily compensate for that: let the app ask for data. The app just has to ask the server for the most recent value when starting up. Then it can act as if it received the push notifications.

遮了一弯 2024-12-24 04:45:59

就像您所说的那样,您只是制作一个存储服务器怎么样?它根本不需要太多内存,而且是一个快速的民意调查。

只需让服务器在每次收到通知时递增,并使用 WCF 服务将累计数量发送到应用程序即可。你大约需要10分钟来写。

How about you just make a storage server like you said you didn't want to. It wouldn't take much memrory at all and would be a quick poll.

Just have the server increment everytime a notication is receieved and send the accumulative number to the app with a WCF service. It'll take you like 10 minutes to write.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文