locked
Toast notifications are not coming using winjs 2.0

    Question

  • Toast notifications are not coming up using "Microsoft.WinJS.2.0", whereas the same code works great when running with "Microsoft.WinJS.1.0". Any idea what could be the cause?

    Here's the code:

    function showToast(toastText) {
           
            var notifications = Windows.UI.Notifications;
            var template = notifications.ToastTemplateType.toastText01;
            var toastXml = notifications.ToastNotificationManager.getTemplateContent(template);
            var toastTextElements = toastXml.getElementsByTagName("text");
            toastTextElements[0].appendChild(toastXml.createTextNode(toastText));
            var toast = new notifications.ToastNotification(toastXml);
            var toastNotifier = notifications.ToastNotificationManager.createToastNotifier();
            toastNotifier.show(toast);
        };



    Saturday, November 30, 2013 4:43 PM

Answers

  • Thanks yanping, I did tried that but finally rebooting the system fixed the issue without any code changes.

    Weird thing is toast notifications of all other apps also stopped coming up like outlook etc..I hope it wasn't due to something my code solution :P

    Monday, December 2, 2013 8:57 AM

All replies

  • Hello,

    The code you posted looks Ok to me. Is any error occurring there?

    To better assist you, I want to confirm with you some information:

    1. Does this happen when you migrate your app form windows 8 to Windows8.1? if so, have you finished updating the project to the release build of Windows 8.1 according the steps introduced in the following link: http://blogs.windows.com/windows/b/appbuilder/archive/2013/10/08/targeting-your-windows-8-1-app-to-the-correct-version-of-winjs-2-0.aspx

      2. Does all your other function in your app work well when you begin to use Microsoft.WinJS.2.0 ?

    # Quickstart: Sending a toast notification (Windows Store apps using JavaScript and HTML)

    http://msdn.microsoft.com/en-us/library/windows/apps/hh465448.aspx

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, December 2, 2013 8:41 AM
    Moderator
  • Thanks yanping, I did tried that but finally rebooting the system fixed the issue without any code changes.

    Weird thing is toast notifications of all other apps also stopped coming up like outlook etc..I hope it wasn't due to something my code solution :P

    Monday, December 2, 2013 8:57 AM