-->

navigation to particular page not working in windo

2019-08-24 02:05发布

问题:

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")

回答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?