简体   繁体   English

Windows Phone 8.1 javascript + html本地吐司通知

[英]Windows phone 8.1 javascript+html local toast notification

I would like to display local toast notification on wp8.1 app build with javascript and html. 我想在wp8.1应用程序的javascript和html上显示本地吐司通知。 I found how to do it with c# and xaml but can't find anywhere how to do it with js and html. 我发现了如何使用c#和xaml做到这一点,但找不到任何地方可以使用js和html做到这一点。 It can just display Hello world, later on i will figure it out myself. 它只能显示“ Hello world”,以后我自己弄清楚。

OK i figured it out. 好吧,我想通了。

here is the message that displays toast. 这是显示吐司的消息。 And in manifest you have to enable toast notifications. 在清单中,您必须启用烤面包通知。

function toast(message) {
document.getElementById("klik").innerHTML = "bla";
var toastTextElements = toastXml.getElementsByTagName("text");
toastTextElements[0].appendChild(toastXml.createTextNode(message));
var toastNode = toastXml.selectSingleNode("/toast");
toastNode.setAttribute("duration", "long");
var audio = toastXml.createElement("audio");
toastNode.appendChild(audio);
var toast = new notifications.ToastNotification(toastXml);
var toastNotifier = notifications.ToastNotificationManager.createToastNotifier();
toastNotifier.show(toast);

} }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM