我刚刚在 Visual Studio 中创建了一个“导航应用程序”项目,我正试图让动态磁贴真正更新。这是我在 default.js 中的内容:
(function () {
"use strict";
WinJS.Binding.optimizeBindingReferences = true;
var app = WinJS.Application;
var activation = Windows.ApplicationModel.Activation;
var nav = WinJS.Navigation;
// init notifications to live tile
var notif = Windows.UI.Notifications;
var tileUpdater = notif.TileUpdateManager.createTileUpdaterForApplication();
var recurrence = notif.PeriodicUpdateRecurrence.halfHour;
var updateTileUrl = "http://bakersdozen13.lfchosting.com/img.xml";
var url = new Windows.Foundation.Uri(updateTileUrl);
tileUpdater.startPeriodicUpdate(url, recurrence);
app.addEventListener("activated", function (args) { ... }); // the js that came w/ the project template
...
})();
当我按 F5 运行它时,然后在我的磁贴开始仪表板 Windows 8 屏幕上查看磁贴,它只有我的徽标,没有别的。我错过了什么?我需要将通知片段放在其他地方吗?
Ps,这是从更新 uri 返回的 xml:
<tile>
<visual>
<binding template="TileWideSmallImageAndText03">
<image id="1" src="http://cdn.godvine.com/uploads/2012/11/image_1353288711_abandoned_church_1.jpg" alt="img alt text here"/>
<text id="1">Dying Man Gets a Miracle in Abandoned Church</text>
</binding>
<binding template="TileSquarePeekImageAndText04">
<image id="1" src="http://cdn.godvine.com/uploads/2012/11/image_1353288711_abandoned_church_1.jpg" alt="img alt text here"/>
<text id="1">Dying Man Gets a Miracle in Abandoned Church</text>
</binding>
</visual>
</tile>