Live Tile update in Windows Phone 8.1

I am trying to create a custom calendar app for Windows Phone 8.1 and I want to show the current day and date in the tiles of the app. I am trying to update the tiles of my Windows Phone 8.1 app on launch screen with the following code

 XmlDocument tileXml2 = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150PeekImageAndText01);
        var textElement2 = tileXml2.GetElementsByTagName("text")[0].AppendChild(tileXml2.CreateTextNode("some text"));

        var tileImage = tileXml2.GetElementsByTagName("image")[0] as XmlElement;
        tileImage.SetAttribute("src", "ms-appx:///Assets/WideLogo.png");


        var tn2 = new TileNotification(tileXml2);
        TileUpdateManager.CreateTileUpdaterForApplication().Update(tn2);


        XmlDocument tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare150x150Block);
        var textElement = tileXml.GetElementsByTagName("text")[0].AppendChild(tileXml.CreateTextNode("01"));
        textElement = tileXml.GetElementsByTagName("text")[1].AppendChild(tileXml.CreateTextNode("Tue"));
        var tn = new TileNotification(tileXml);
        //.CreateTileUpdaterForApplication().
        //TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdate()
        TileUpdateManager.CreateTileUpdaterForApplication("App").Clear();
        TileUpdateManager.CreateTileUpdaterForApplication("App").Update(tn);

      

But when I run the code, the TileSquare150x150Block is only updated when the tile is resized, the TileWide310x150PeekImageAndText01 is not updated.

Could you please help me to update some snippets? Also how can I get the current date in the app drawer? Thank!

+3


source to share


1 answer


Because you are calling TileUpdateManager.CreateTileUpdaterForApplication ("Application"). Clear () after registering TileWide310x150PeekImageAndText01. Thus, all updates are removed.



+1


source







All Articles