locked
how does Periodical tile update work in Windows 8.1

    Question

  • In Visual Studio 2013 and Windows 8.1 when you open up the Package.appxmanifest file you get to set the following under Tile Update:

    Recurrence

    URI Template


    are these all I need to do to get periodically update tile to work?

    in my project, I set it to Half hour and I put up a Web api controller for generating  the tile content , the following is sample of the tile my controller generates:

    <?xml version="1.0" encoding="UTF-16"?>
    <tile>
    <visual version="2">
    <binding fallback="TileWideSmallImageAndText04"  template="TileWide310x150SmallImageAndText04">
    <text id="1">Spelling Champion</text>
    <text id="2">Forth Grade Spelling List is available for download</text>
    <Images id="1" alt="Spelling Champion" src="http://localhost:3593/content/Images/Logo1.png"/>
    </binding>
    <binding fallback="TileSquareImage" template="TileSquare150x150Image">
    <Images id="1" alt="Spelling Champion" src="http://localhost:3593/content/Images/Logo2.png"/>
    </binding>
    </visual>
    </tile>

    but when I monitored my web api site, after 30 minutes, the app does not fire up a call to pull the tile content. is there anything I missed?

    I saw some code to call StartPeriodicUpdate method, so I included that call in OnLaunched event handler, the call to the tile site is made, but the tile of the app did not change.
     
    PeriodicUpdateRecurrencerecurrence = PeriodicUpdateRecurrence.HalfHour;
    Uri  url = newSystem.Uri("http://localhost:3593/api/tile/");
    TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdate(url, recurrence);


    Peter Lu



    • Edited by Peter Lu ZC Saturday, February 15, 2014 2:27 PM
    Saturday, February 15, 2014 1:57 PM

Answers

  • okay, I did some more research and I think I can say I have figured this thing out:

    there are 2 ways to get the live tile update to work as Rob said. once is set it up in Manifest, once is code in

    OnLaunched to call StartPeriodicUpdate method.

    to me these first way is simpler, no coding is needed, you just set frequency and a URI in manifest. you even can set something like this http://65.24.101.48/api/Tile/{language}/{region}

    to provide more targeted tile for users in different language and in different region.

    but you need to be aware of a limitation of it when it comes to testing. that is it does not pull from tile from a any site hosted locally. (like http://localhost:1234/api/Tile/

    with the second method, first of all, you need to write code, secondly you might need to have it configurable so that you do not hardcode the value... but in the second way, it works even if the site is hosted locally. 


    Peter Lu .


    • Marked as answer by Peter Lu ZC Monday, February 17, 2014 8:46 PM
    • Edited by Peter Lu ZC Monday, February 17, 2014 8:46 PM
    Monday, February 17, 2014 8:46 PM

All replies

  • These are two ways to achieve essentially the same thing. Your problem is likely that your web server is on localhost. Windows Store apps cannot create network connections back to the local system except for debugging.  

    The timing will also not be exactly 30 minutes.

    --Rob

    Saturday, February 15, 2014 3:43 PM
    Moderator
  • Ok, I got some answers and some more questions

    I figured out there is some problem in XML serialization, <image> was coded as <images>. after fix the serialization problem I got this xml and it start to work even the service is in local host. Rob is right, it is not exactly 30 minutes, it is much shorter... about 15 minutes once...

    <?xml version="1.0" encoding="utf-16"?>
    <tile>
      <visual version="2">
        <binding template="TileSquare150x150Text04" fallback="TileSquareText04">
          <text id="1">Spelling Champion</text>
        </binding>
        <binding template="TileWide310x150Text03" fallback="TileWideText03">
          <text id="1">Spelling Champion</text>
        </binding>
        <binding template="TileSquare310x310Text09">
          <text id="1">Spelling Champion</text>
        </binding>
      </visual>
    </tile>

    tile>
      <visual version="2" addImageQuery="true">
        <binding template="TileSquare150x150Image" fallback="TileSquareImage">
          <image id="1" src="http://localhost:3593/content/Images/Logo2.png" alt="Web image" />
        </binding>
        <binding template="TileWide310x150ImageAndText01" fallback="TileWideImageAndText01">
          <image id="1" src="http://localhost:3593/content/Images/Logo3.png" alt="Web image" />
          <text id="1">This tile notification uses web images.</text>
        </binding>
        <binding template="TileSquare310x310Image">
          <image id="1" src="http://localhost:3593/content/Images/Logo2.png" alt="Web Image" />
        </binding>
      </visual>
    </tile>

    now, my questions are :

    these are the lines make it working.

    PeriodicUpdateRecurrencerecurrence = PeriodicUpdateRecurrence.HalfHour;
    Uri  url = newSystem.Uri("http://localhost:3593/api/tile/");

    TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdate(url, recurrence);

    but I do have these setups in the manifest file, how to access the settings from the code?

    what do these setting in the manifest file do? nothing?


    Peter Lu .

    • Edited by Peter Lu ZC Monday, February 17, 2014 8:46 PM
    Saturday, February 15, 2014 4:16 PM
  • okay, I did some more research and I think I can say I have figured this thing out:

    there are 2 ways to get the live tile update to work as Rob said. once is set it up in Manifest, once is code in

    OnLaunched to call StartPeriodicUpdate method.

    to me these first way is simpler, no coding is needed, you just set frequency and a URI in manifest. you even can set something like this http://65.24.101.48/api/Tile/{language}/{region}

    to provide more targeted tile for users in different language and in different region.

    but you need to be aware of a limitation of it when it comes to testing. that is it does not pull from tile from a any site hosted locally. (like http://localhost:1234/api/Tile/

    with the second method, first of all, you need to write code, secondly you might need to have it configurable so that you do not hardcode the value... but in the second way, it works even if the site is hosted locally. 


    Peter Lu .


    • Marked as answer by Peter Lu ZC Monday, February 17, 2014 8:46 PM
    • Edited by Peter Lu ZC Monday, February 17, 2014 8:46 PM
    Monday, February 17, 2014 8:46 PM