locked
Updating live tiles RRS feed

  • Question

  • Hi,

    I am using the following code to update my live tile. But this doesnt do it periodically. I want my live tiles to update every 10 seconds. How can i achieve this??

    XmlDocument tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150ImageAndText01);
                XmlNodeList tileTextAttributes = tileXml.GetElementsByTagName("text");
                XmlNodeList tileImageAttributes = tileXml.GetElementsByTagName("image");
                ((XmlElement)tileImageAttributes[0]).SetAttribute("src", "ms-appx:///icon310x150.png");
                ((XmlElement)tileImageAttributes[0]).SetAttribute("alt", "red graphic");
                //  tileImageAttributes[0].
                tileTextAttributes[0].InnerText = "High Score: " + App.localSettings.Values["highscore"];

                XmlDocument squareTileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare310x310ImageAndText01);

                XmlNodeList squareTileTextAttributes = squareTileXml.GetElementsByTagName("text");
                squareTileTextAttributes[0].AppendChild(squareTileXml.CreateTextNode("High Score: " + App.localSettings.Values["highscore"]));
                XmlNodeList squareTileImageAttributes = squareTileXml.GetElementsByTagName("image");
                ((XmlElement)squareTileImageAttributes[0]).SetAttribute("src", "ms-appx:///icon310x310.jpg");
                IXmlNode node = tileXml.ImportNode(squareTileXml.GetElementsByTagName("binding").Item(0), true);
                tileXml.GetElementsByTagName("visual").Item(0).AppendChild(node);
                DateTime dueTime = DateTime.Now.AddSeconds(5);
                ScheduledTileNotification tileNotification = new ScheduledTileNotification(tileXml, dueTime);
                // tileNotification.ExpirationTime = DateTimeOffset.UtcNow.AddSeconds(10);
                TileUpdateManager.CreateTileUpdaterForApplication().AddToSchedule(tileNotification);

    Tuesday, January 21, 2014 7:09 AM

Answers

  • http://social.msdn.microsoft.com/Forums/windowsapps/en-US/c8c627b9-f991-4ca7-86e3-462834bfc229/window-live-tile-template-in-w8?forum=winappswithcsharp

    thanks, Sarath s


    Please remember to mark the replies as answers if they help and unmark them if they provide no help , or you may vote-up a helpful post


    • Edited by Bilaal John S Tuesday, January 21, 2014 11:22 AM Sentence
    • Marked as answer by meesun Tuesday, January 21, 2014 6:32 PM
    Tuesday, January 21, 2014 11:21 AM
  • ahhhh. that is the notificationeuqueue.

    var updater = TileUpdateManager.CreateTileUpdaterForApplication();
    
                updater.EnableNotificationQueue(true);
    
                //OR ONE or more of those
                updater.EnableNotificationQueueForSquare150x150(true);
                updater.EnableNotificationQueueForSquare310x310(true);
                updater.EnableNotificationQueueForWide310x150(true);
    
                // up to five notifications can be showed
                updater.Update(notification1);
                updater.Update(notification2);
                ...
    there are no settings possible for how and when  the tiles flips


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    • Marked as answer by meesun Tuesday, January 21, 2014 6:32 PM
    Tuesday, January 21, 2014 10:23 AM

All replies

  • Hi meesun,

    Here is a sample provide by Dave, take a look, should help you:  http://code.msdn.microsoft.com/windowsapps/Tile-Update-every-minute-68dbbbff

    ScheduledTileNotification class might be a good start .

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Tuesday, January 21, 2014 9:29 AM
    Moderator
  • but even with that sample; every 10 second is very much. the ScheduledTileNotification has a limit of 4096 scheduled notifications. and much of the notifications will be missed by the user.

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Tuesday, January 21, 2014 9:52 AM
  • Yes, the question might be why you want to update the every 10 seconds.

    Take a look at Tiles and badges,

    How often should your tile update?

    If you choose to use a live tile, consider how often the tile should be updated

    • For personalized content, such as message counts or whose turn it is in a game, we recommend that you update the tile as the information becomes available, particularly if the user would notice that the tile content was lagging, incorrect, or missing.
    • For nonpersonalized content, such as weather updates, we recommend that the tile be updated no more than once every 30 minutes. This allows your tile to feel up-to-date without overwhelming your user.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Tuesday, January 21, 2014 9:58 AM
    Moderator
  • Thank u so much James and Dave for your interest.

    Extremely sorry i have done a blunder in framing the question.

    I want my app's tile to rotate or spin every ten seconds. To explain it in detail, I want to display the highscore which i store in my app's isolated storage. At an interval of ten seconds i want the tile to spin or rotate to display the highscore. After another ten seconds i want the apps icon to spin back. This should repeat forever.

    Tuesday, January 21, 2014 10:16 AM
  • ahhhh. that is the notificationeuqueue.

    var updater = TileUpdateManager.CreateTileUpdaterForApplication();
    
                updater.EnableNotificationQueue(true);
    
                //OR ONE or more of those
                updater.EnableNotificationQueueForSquare150x150(true);
                updater.EnableNotificationQueueForSquare310x310(true);
                updater.EnableNotificationQueueForWide310x150(true);
    
                // up to five notifications can be showed
                updater.Update(notification1);
                updater.Update(notification2);
                ...
    there are no settings possible for how and when  the tiles flips


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    • Marked as answer by meesun Tuesday, January 21, 2014 6:32 PM
    Tuesday, January 21, 2014 10:23 AM
  • http://social.msdn.microsoft.com/Forums/windowsapps/en-US/c8c627b9-f991-4ca7-86e3-462834bfc229/window-live-tile-template-in-w8?forum=winappswithcsharp

    thanks, Sarath s


    Please remember to mark the replies as answers if they help and unmark them if they provide no help , or you may vote-up a helpful post


    • Edited by Bilaal John S Tuesday, January 21, 2014 11:22 AM Sentence
    • Marked as answer by meesun Tuesday, January 21, 2014 6:32 PM
    Tuesday, January 21, 2014 11:21 AM