简体   繁体   English

Windows Phone中未更新实时磁贴

[英]live tile is not updating in Windows Phone

i am developing a windows phone app where application has an option to pin the application to home screen. 我正在开发Windows Phone应用程序,其中应用程序可以选择将应用程序固定到主屏幕。 And i am using ShellTileSchedule class to do schedule the update periodically. 而且我正在使用ShellTileSchedule类来定期安排更新。 Some reason my app is not pushing any update to tile. 由于某些原因,我的应用未将任何更新推送到图块。 My app data is completely local, no data is coming from outside. 我的应用程序数据完全是本地数据,没有数据来自外部。

In my tile update, i am not updating any image on the lile, but only changing the data to display. 在我的图块更新中,我不会更新lile上的任何图像,而只是更改要显示的数据。

 foreach (ShellTile tile in ShellTile.ActiveTiles)
 {
            IconicTileData tileData = GetTileData();

            tileSchedule = new ShellTileSchedule(tile, tileData);
            tileSchedule.Interval = UpdateInterval.EveryHour;
            tileSchedule.Recurrence = UpdateRecurrence.Interval;
            tileSchedule.Count=GetUserData();
            tileSchedule.StartTime = DateTime.Now;
            tileSchedule.Start();

            tile.Update(tileData);
}

Any help in this regard? 在这方面有帮助吗? Or do i need to background agent to update the tile? 还是我需要后台代理来更新磁贴?

ShellTileSchedule can only pull images off the web, not from the phone itself. ShellTileSchedule只能从网络提取图像,而不能从手机本身提取图像。 This is one of the limitations of ShellTileSchedule. 这是ShellTileSchedule的限制之一。 If you want to set background images to resources on the phone, look at using push notifications instead. 如果要将背景图像设置为手机上的资源,请查看使用推送通知。

Source: http://www.silverlightshow.net/news/WP7-Using-ShellTileSchedule-to-update-your-app-s-Live-Tile-background.aspx 来源: http//www.silverlightshow.net/news/WP7-Using-ShellTileSchedule-to-update-your-app-s-Live-Tile-background.aspx

Shouldn't you be setting a ShellTileSchedule.RemoteImageUri somewhere? 您不应该在某个地方设置ShellTileSchedule.RemoteImageUri吗? I mean, that's kinda what ShellTileSchedule is there for, to update your tile image from a remote Uri on a regular interval... See sample of how to use this class for secondary tiles here . 我的意思是,这有点像ShellTileSchedule的目的,用于以固定的时间间隔从远程Uri更新您的图块图像... 在此处查看有关如何将此类用于辅助图块的示例。

You have to fill the properties of IconicTileData. 您必须填写IconicTileData的属性。 In your sample you just create empty data structure and use it for the schedule, that won't work. 在您的示例中,您只是创建一个空的数据结构并将其用于计划,这是行不通的。 I use it like this: 我这样使用它:

IconicTileData newTileData = new IconicTileData
{
    Title = SharedResources.AppName,
    Count = BatteryHelper.BateryLevel,
    SmallIconImage = new Uri(@"/Assets/IconicSmall.png", UriKind.Relative),
    IconImage = new Uri(@"/Assets/IconicMedium.png", UriKind.Relative),
};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM