Monday, October 29, 2012

WP7 push notifications received in application

WP7 push notifications received in application

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?

Answers & Comments...

Answer: 1

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.

by : Heinrich Ulbrichthttp://stackoverflow.com/users/56658

Answer: 2

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.

by : Michael Puckett IIhttp://stackoverflow.com/users/1260140




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog