简体   繁体   中英

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. I found how to do it with c# and xaml but can't find anywhere how to do it with js and html. It can just display Hello world, later on i will figure it out myself.

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

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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