I have not used Background Agents for updating LiveTiles. I update the tile on exiting of the app and on Application_Deactivated
.
private void Application_Deactivated(object sender, DeactivatedEventArgs e)
{
CycleManager pCycMan = CycleManager.Instance;
pCycMan.WriteToIsolatedStorage();
ResourceManager resMan = new ResourceManager("xxx.AppResources", Assembly.GetExecutingAssembly());
ShellTile PrimaryTile = ShellTile.ActiveTiles.First();
StandardTileData tile = new StandardTileData();
try
{
if (PrimaryTile != null)
{
tile.BackTitle = resMan.GetString("liveTileTitle");
tile.BackBackgroundImage = new Uri("/Background.png", UriKind.Relative);
if (pCycMan.GetStartDate() == pCycMan.GetDefaultDate())
{
tile.Title = resMan.GetString("liveTileNotTrackingStatus");
}
else
{
tile.Title = m_liveTileText;
}
PrimaryTile.Update(tile);
}
}
catch(Exception)
{
}
}
Is is a good practice to do so? The app is published and I have received a StackTrace with a COMException. It shows that the exception is raised on execution of Microsoft.Phone.Shell.ShellTile.Update
after the XXX.App.Application_Deactivated
Does anyone know of this exception or faced such situations? It would be really helpful if someone could guide me on this.