Load data in the background? RRS feed

  • Question

  • Hi - what is the best way to load data from a web service in the background and update my Tile (while my app is not Active)? I know I can create a background Task with a Time trigger but this requires app lock screen permissions - which is more than I want. My app does not have to appear on the lock screen - I just want to be able to update my app Tile with data.

    Is there any other way to accomplish this without requesting the user for app lock screen permissions?

    There reason I ask is that there seems to be many apps in Windows 8 that seems to get updated without appering on the lock screen and without I have given them permissions (e.g. the news app that comes with windows 8).


    Tuesday, November 6, 2012 7:32 PM


All replies

  • use push notifications or http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.notifications.tileupdater.startperiodicupdate.aspx

    but you will need a server

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Tuesday, November 6, 2012 7:38 PM
  • Thanks - I just created a asp.net webservice that returns a XMLDocument object and the XML looks fine in IE.

    I used the following code to call the StartPeriodicUpdate:

    var tileupdater = TileUpdateManager.CreateTileUpdaterForApplication();
    tileupdater.StartPeriodicUpdate(new Uri("http://localhost:65528/wsLiveTile.asmx"), PeriodicUpdateRecurrence.HalfHour);

    Do I have to wait 30 min to test this (that is before my webservice is called)? Maybe there is something wrong - it should be called right away and then wait 30 min I guess?

    Also - can I combine the StartPeriodicUpdate with "normal" tile updates like:


    • Edited by crexes Tuesday, November 6, 2012 8:42 PM
    Tuesday, November 6, 2012 8:39 PM
  • the asmx is returning a xml like you normally use in a TileNotification? Yes then just wait 30 minutes.

    and not sure if can combine but i thinnk update will stop the periodupdate

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Tuesday, November 6, 2012 9:06 PM
  • Hi - ok I got it to work. For some reason I had to create asp.net page that returns the xml.

    Also - it seems like I can combine  StartPeriodicUpdate with "normal" tile updates which is good. However - I read that I can't get more than 1 tile update per 30 minute from my server (for instance - I can't retrieve 5 tile messages like I can when using normal TileNotification) :( I guess I have to use push notifications for that - but that seems a bit complex for me.

    Tuesday, November 6, 2012 9:26 PM
  • i think you need this method this can do multiple messages http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.notifications.tileupdater.startperiodicupdatebatch.aspx

    and like in documation descibed, turn on first the notification queue http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.notifications.tileupdater.enablenotificationqueue.aspx

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    • Edited by Dave SmitsMVP Tuesday, November 6, 2012 9:45 PM
    • Marked as answer by crexes Tuesday, November 6, 2012 10:11 PM
    Tuesday, November 6, 2012 9:43 PM
  • Fantastic - thanks!
    Tuesday, November 6, 2012 10:11 PM