windows-phone-8.1live-tiletext-based

How do you make live tiles for Windows Phone 8.1 Apps?


How do you make live tiles for Windows Phone 8.1 Apps?

It is the best kept secret on the internet!

I am trying to make a tile, which whenever the app is suspended, it updates the live tile with some text.

I have read/watched roughly a dozen "tutorials" on live tiles, and none of them are compatible with Windows Phone 8.1.

At a high level, what steps do I need to follow to accomplish this?

Note: I am well aware that Tile Templates exist...but the secret is what to do with them. All of the code out there not only does not compile for Windows Phone 8.1, but on top of that, the code assumes that people already know how to make the live tiles.


Solution

  • Below is how to create live tile in windows phone 8.1

     //Generates an image tile
     StringBuilder sb = new StringBuilder("<tile>");
            sb.Append("<visual version=\"2\">");
            sb.Append("<binding template=\"TileSquare150x150Image\" fallback=\"TileSquarePeekImage01\">");
            sb.Append("<image id=\"1\" src=\"ms-appx:///Assets/Logo.scale-141.png\"/>");
            sb.Append("</binding>");
            sb.Append("</visual>");
            sb.Append("</tile>");
            XmlDocument xmldoc = new XmlDocument();
            xmldoc.LoadXml(sb.ToString());
    
            TileNotification tileNotification = new TileNotification(xmldoc);
    
            TileUpdater tileUpdator = TileUpdateManager.CreateTileUpdaterForApplication();
    
            tileUpdator.Update(tileNotification);