4

in toast message in windows phone 7, when clicking on that message the application opens thats fine,

i just want to navigate to specific page when the toast message is clicked,

is there any way to do it?

both in 7 and mango update???

or

in http://samidipbasu.com/2011/06/14/push-notification-payloads/ in this link when we read for toast notification, we have an extra parameter called wp:Param in xml format to send. How they were sending this wp:Param data in windows 7.0(before mango update). Any idea ??

Eran
  • 387,369
  • 54
  • 702
  • 768
curiosity
  • 1,207
  • 5
  • 23
  • 34

3 Answers3

3

Support for navigating to a particular page is supported in Mango. Below is an example that does not require an HTTP channel, but must be executed by a background agent (not the application itself):

var toast = new ShellToast
{
    Title = "Title",
    Content = "Toast content",
    NavigationUri = new Uri("/SomeOtherView.xaml", UriKind.Relative)
};

toast.Show();

NOTE: The NavigationUri functionality is also supported by toast sent via HTTP push notifications

Richard Szalay
  • 83,269
  • 19
  • 178
  • 237
1

all the info you need to know about push notifications is here

harryovers
  • 3,087
  • 2
  • 34
  • 56
  • i hav seen this.. i want the specific answer – curiosity Jun 28 '11 at 10:09
  • you need to process the information recieved and the navigate to a different page once the app has loaded. if you post some code icould be a bit more specific – harryovers Jun 28 '11 at 10:11
  • static string toastMessage = "" + "" + "" + "{0}" + "{1}" + "" + ""; This is the way i send the xml message.. to toast notification.. This notification s sent using wcf service.. and even when client is closed the message is transferred. in such case how can i write the navigation code at client side? I guess you are clear – curiosity Jun 28 '11 at 11:19
  • have you got some code for when the app loads and you read the message? – harryovers Jun 28 '11 at 11:32
  • let me ask in different way.. http://samidipbasu.com/2011/06/14/push-notification-payloads/ in this link when we read for toast notification, we have an extra parameter called wp:Param in xml format to send. How they were sending this wp:Param data in windows 7.0(before mango update). Any idea ?? – curiosity Jun 28 '11 at 13:07
  • you will have to do something to parse the message sent, if you send messages in a known format you can just pull out the details you need e.g. Order Ready your order (id: 12345) is ready for collection. you would be able to parse the massage and read the id and the title to determin what the action should be. – harryovers Jun 28 '11 at 13:14
  • but these codes hav to be written in client side alone.. when we go for shelltile by pressing back the application closes.. so whatever the code written in client side is of no use – curiosity Jun 29 '11 at 07:59
  • harryovers, the part that's completely unclear is this: if your application was *not* running when the toast arrived, how do you get hold of the notification payload? All of the examples I've seen - including the ones in that article you link to - totally fail to deal with this. They only show how to see the payload if your app was already running when the toast arrived. But the whole point scenario toast is designed to support is the one where you app isn't actually running. You keep asking for code, but that's the point: people are trying to work out what code could support this scenario! – Ian Griffiths Jul 01 '11 at 08:02
  • To put it another way: when my application starts up, how can I tell whether I was launched by the user running my app in the usual fashion, or via toast? If the user sees toast for my app (while it's not running) and taps that toast, my app gets launched. How can I detect that this is what happened? The article you link to doesn't address this, so it does not in fact contain "all the info you need to know about push notifications" – Ian Griffiths Jul 01 '11 at 08:05
1

@curiosity .. Toast & Tile payloads are pre-defined so that the OS can process these bits coming from MPNS after your app registers shellToast/shellTile. The extra parameters in the payloads are supposed to supported starting with Mango. As your app's first page (or whichever XAML page is in the URL) launches from the deep-toast, the developer should be able to listen in on the OnNavigatedTo() event to do something special with the params in the incoming URL (query string). Please see some later posts on my blog for examples & let me know if it helps.

Thanks!

Sam Basu
  • 966
  • 6
  • 14
  • so it is not possible in windows 7? – curiosity Jun 29 '11 at 05:40
  • Nope. The OS will start processing the new bits in the payload starting with Mango; not now. Now, if your Push payload does include the extras now in 7.0, the OS might ignore and still work the regular toasts or it may stop working. Hope this helps. – Sam Basu Jun 29 '11 at 16:29
  • So today, is it even possible to tell the difference between running the app in the usual way (e.g., user taps my app's tile) vs launching the app from toast? When my app starts, I want to be able to ask "did I just get launched via toast?" (I'm OK with not having additional payload data - I just want a simple yes/no to that question.) – Ian Griffiths Jul 01 '11 at 08:07
  • Ian Griffiths -- not that I know of in Windows Phone 7.0 – Sam Basu Jul 05 '11 at 19:58