locked
How to send a push notification to a secondary tile? RRS feed

  • General discussion

  • Hello,

    I am trying to send a push notification to a secondary tile. When I start metro application I suscribte to notifications doing this for tile

    var notificationChannel = Windows.Networking.PushNotifications.PushNotificationChannelManager.createPushNotificationChannelForApplicationAsync();

    and this for a secondary tile:

    var notificationChannel2 = Windows.Networking.PushNotifications.PushNotificationChannelManager.createPushNotificationChannelForSecondaryTileAsync("section.portada");

    Both calls my 3rd party service for registration. I receive the same url channel from WNS service.

    I know how to send a push notification for tile.

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

    But I don't know how to send a notification for secondary tile. How can I say wich is de secondary tile id in the push message?


    thanks!



    Monday, August 6, 2012 6:57 PM

All replies

  •    try this :)

    function updateTile(imageUrl, value) {
            var notifications = Windows.UI.Notifications;
            var updateManager = notifications.TileUpdateManager.createTileUpdaterForApplication();
            updateManager.enableNotificationQueue(true);

            var tileXml = notifications.TileUpdateManager.getTemplateContent(notifications.TileTemplateType.tileWideSmallImageAndText02);

            var tileImageAttributes = tileXml.getElementsByTagName("image");
            tileImageAttributes[0].setAttribute("src", "ms-resource:" + imageUrl);
            //tileImageAttributes[1].setAttribute("src", "ms-resource:" + imageUrl2);
            var tileTextAttributes = tileXml.getElementsByTagName("text");
            tileTextAttributes[0].appendChild(tileXml.createTextNode(value ));

            var tileNotification = new notifications.TileNotification(tileXml);
            updateManager.update(tileNotification);
        }

        function clearTiles() {
            var notifications = Windows.UI.Notifications;
            var updateManager = notifications.TileUpdateManager.createTileUpdaterForApplication();
            updateManager.clear();
        }

    Friday, August 10, 2012 2:39 PM