Wednesday, April 1, 2015

Custome notification sound is playing only if i have breakpoint windows universal 8.1

Hi when push notification is received i am displaying toast notification. i have issue that is if i have break point in below function then and then only custom notification sound is playing else notification sound is not playing.I thought might be audio is not loading so i added Task.delay for 2 sec/5 sec but no luck. What could be the issue.




public static void AddTostNotification(String xmlDocument)
{

List<string> messageSection = PushNotificationHelper.GetMessageAndLandingPage(xmlDocument);

ToastTemplateType toastTemplate = ToastTemplateType.ToastText01;

XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(toastTemplate);
XmlNodeList toastTextElements = toastXml.GetElementsByTagName("text");
toastTextElements[0].AppendChild(toastXml.CreateTextNode(messageSection[0]));
// toastTextElements[1].AppendChild(toastXml.CreateTextNode(message));

IXmlNode toastNode = toastXml.SelectSingleNode("/toast");
((XmlElement)toastNode).SetAttribute("launch", messageSection[1]);

XmlElement audio = toastXml.CreateElement("audio");
audio.SetAttribute("src", "ms-appx:///Assets/Guitar.wav");

toastNode.AppendChild(audio);

//launch tost immediatly
ToastNotification toast = new ToastNotification(toastXml);
ToastNotificationManager.CreateToastNotifier().Show(toast);

}




Dattatray


No comments:

Post a Comment