0

I am sending toast notifications to windows phone 8 using push sharp and getting those notification. Currently when I tap on toast app launches and first page of the my app opens up. But instead of this i want to navigate to particular page of my app when i click on toast.

I think for that I have to use .withParameter() extension of WindowsPhoneToastNotification, but I am not able to get what should be passed in key and value pair of this extension. Also .withNavigatePath() is also not working.

Using this updated code.But still no success.App is not navigating to the desired page.

push.QueueNotification(new WindowsPhoneToastNotification()
    .ForEndpointUri(new Uri("MYDeviceEndpointURI")) 
    .WithNavigatePath("/Home.xaml")
    .WithText1("PushSharp")
    .WithText2("This is a Toast"));
    .WithParameter("param1","1")
Nitika
  • 103
  • 11
  • What is your current landing page of your app when you open it without any push notifications?... – pazcal Nov 19 '13 at 13:40
  • when i open my app without any push notification Login.xaml is opened. – Nitika Nov 19 '13 at 13:46
  • Hmzz.. seems like you are not the only one with the problem http://stackoverflow.com/questions/16492954/pushsharp-windows-phone-deep-linking-on-toast-notifcation. Is there any way you can provide the generated xml template, generated by PushSharp? – pazcal Nov 19 '13 at 13:48

1 Answers1

1

Update 3 (as the other updates weren't the solutions)

I noticed a small example code on GitHub:

//-----------------------------
// WINDOWS PHONE NOTIFICATIONS
//-----------------------------
//Configure and start Windows Phone Notifications
push.RegisterWindowsPhoneService();

//Fluent construction of a Windows Phone Toast notification
//IMPORTANT: For Windows Phone you MUST use your own Endpoint Uri here that gets generated within your Windows Phone app itself!
push.QueueNotification(new WindowsPhoneToastNotification()
    .ForEndpointUri(new Uri("DEVICE REGISTRATION CHANNEL URI HERE"))
    .ForOSVersion(WindowsPhoneDeviceOSVersion.Eight)
    .WithNavigatePath("/Home.xaml")
    .WithParameter("param1","1")
    .WithText1("PushSharp")
    .WithText2("This is a Toast"));
);

The difference I see here is that in the sample they added also .ForOSVersion(). Can you give that a try?

pazcal
  • 929
  • 5
  • 26
  • Need to navigate to Home.xaml page so i have written "/Home.xaml in `.WithNavigatePath` But still not able to navigate. – Nitika Nov 19 '13 at 13:40
  • If instead of using push sharp,I use the code given [link](http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj662938%28v=vs.105%29.aspx) I was able to navigate to desired page with parameter names and values. but while sending toast notification using push sharp navigation is not working. – Nitika Nov 19 '13 at 13:56
  • Updated my comment again, can you take a look again :) – pazcal Nov 19 '13 at 13:58
  • It worked :) Thanks.I wonder how I was missing the `.ForOSVersion()`. But a bit of problem is still there,in the end of parameter value additional &amp is written like `/Home.xaml?q=1&amp` – Nitika Nov 19 '13 at 14:16
  • That's annoying. Actually weird as this bug was fixed like 8 months ago: https://github.com/Redth/PushSharp/issues/131 and also in the code itself: https://github.com/Redth/PushSharp/blob/master/PushSharp.WindowsPhone/WindowsPhoneNotification.cs (line 145) – pazcal Nov 19 '13 at 14:26
  • Yeah. I also went through that. I have added Version 2.0.4.0 of push sharp nuget package. But still &amp is being shown in the last. Any how this is not making any difference to the current working of my app. :) The problem now i am facing is Toast notification disappears after 10 sec,if user does not tap on that and I am not able to get How to handle this, if user misses the notification.Please suggest.Thanks :) – Nitika Nov 19 '13 at 14:32
  • The main problem of this question is solved, so this answer can be marked as answer. For the bug, I'll try to add an issue on the issuetracker of PushSharp. – pazcal Nov 19 '13 at 14:36
  • Email me pls as you don't have enough reputation points to start a chat :) – pazcal Nov 20 '13 at 07:23
  • asked another question [here](http://stackoverflow.com/questions/20098220/toast-notification-disappears-after-10-sec-in-windows-phone-8) regarding this. – Nitika Nov 20 '13 at 14:14