Update LiveTile from Background Task WP8.1

拟墨画扇 提交于 2019-12-11 02:43:46

问题


I cannot update manually pinned tile from Background Task.

var updater = TileUpdateManager.CreateTileUpdaterForApplication();
updater.EnableNotificationQueue(true);
updater.Clear();

XmlDocument tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWideText03);

var title = "Test text";
string titleText = title == null ? String.Empty : title;
tileXml.GetElementsByTagName("text")[0].InnerText = titleText;

updater.Update(new TileNotification(tileXml));

Exception fires on CreateTileUpdaterForApplication(); with message: The application identifier provided is invalid.

I heard what this problem occurs on Windows Phone with 8.1 update, but I not found any solutions... Please help.


回答1:


I was having exactly the same issue. After three hours of research (damn waste of time :/) I found the solution:

var updater = TileUpdateManager.CreateTileUpdaterForApplication("App");

Thanks to the guy who posted that (http://social.msdn.microsoft.com/Forums/windowsapps/en-US/83498107-fe0d-4a8b-93f3-02d484983953/tileupdatemanager-throws-exception?forum=wpdevelop)! Cannot believe that I did not see the "(+1 overload(s))" when hovering the mouse over the call -.-



来源:https://stackoverflow.com/questions/25125246/update-livetile-from-background-task-wp8-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!