How to Deep Link Push Notification in WP8

2019-08-17 17:53发布

问题:

I am using Parse to send push notifications to my app. I followed all the steps present in the documentation. It works perfectly fine.

When I receive the push notification, on tap of it will launch the application. However I want to navigate to a particular page in my app. I am unable to find out where to set this navigation parameter. Is there a way to do it ?

If this is possible then how to pass parameter via query string while navigating to that page?

回答1:

I found this sample. You can set a custom xaml file as launching url. Here is the complete project:WNS Notifications for Windows and Windows Phone Universal App Sample. Hope it helps.

 var toastDescriptor = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText02);

        var txtNodes = toastDescriptor.GetElementsByTagName("text");

        txtNodes[0].AppendChild(toastDescriptor.CreateTextNode("SL8.1 Demo"));
        txtNodes[1].AppendChild(toastDescriptor.CreateTextNode("Deeplink me"));

        // Launch args
        var toastNode = toastDescriptor.SelectSingleNode("toast");
        ((XmlElement)toastNode).SetAttribute("launch", "/toastpage.xaml?findme=true");

        var toast = new ToastNotification(toastDescriptor);
        var toastNotifier = ToastNotificationManager.CreateToastNotifier();
        toastNotifier.Show(toast);