1

How can I update my tiles in the background while my app is not running in the foreground? I tried looking into push notifications, but I don't think that'll get me anywhere.

Where to begin? I know how to create tiles already.

Mathias Lykkegaard Lorenzen
  • 15,031
  • 23
  • 100
  • 187

4 Answers4

2

An app cannot update it's tile without running at least once. Because apps do not run immediately on installation, it isn't possible for a tile to be "live" until it is launched. After app installation, the user needs to launch the app for it to set up and begin receiving updates in any form (whether they are push notifications, periodic updates, scheduled notifications, or local notifications raised with or without a background task). The default tile will be shown from the point the user installs the app until the time the app sets up tile updates.

MSDN has a good article on choosing the right notification delivery mechanism, which also links to related code samples: http://msdn.microsoft.com/en-us/library/windows/apps/hh779721.aspx

Nathan Kuchta
  • 13,482
  • 2
  • 26
  • 35
  • Can you detail the use of background tasks to update live tiles? They don't seem to be running at all in the background for me, even with lock screen permission. I have set a 15 minute interval with a TimeTrigger. – Mathias Lykkegaard Lorenzen Sep 28 '12 at 06:59
  • Mathias posted this follow up question here: http://stackoverflow.com/questions/12649247/httpclient-getasync-fails-in-background-task-with-lock-screen-access-and-both-ti – Nathan Kuchta Sep 29 '12 at 13:29
1

You have to use a TileNotification from the Windows.UI.Notifications namespace. The documentation for the namespace is here.

There's also an example Stocks app that uses notifications here (search for 'Tiles and notifications')

Further, there's an 'App tiles and badges' sample that shows both text and image updates to a live tile.

vlad
  • 4,748
  • 2
  • 30
  • 36
1

As far as I know, you have to use a background task. If the user hasn't run the app once, you can't show any interactive tile data.

Manuel Schweigert
  • 4,884
  • 4
  • 20
  • 32
0

Adding Live tiles to the desktop using c# code:

List<Uri> StoryUrls = new List<Uri>();
        StoryUrls .Add(new Uri("tiles.xml"));

        TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);
        TileUpdateManager.CreateTileUpdaterForApplication().Clear();
        TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdateBatch(StoryUrls, PeriodicUpdateRecurrence.HalfHour);

The xml should be in the following format:

  • tiles.xml should follow microsoft format show in step 5 Here

Hope this helps

John Royceton Arthur
  • 2,368
  • 1
  • 12
  • 8