InvalidOperationException when using ShellTileSchedule on Windows Phone 7
I'm getting an InvalidOperationException when using the following code to create a ShellTileSchedule:
ShellTileSchedule sch;
public void UpdateTile()
{
sch = new ShellTileSchedule();
sch.Recurrence = UpdateRecurrence.Interval;
sch.Interval = UpdateInterval.EveryHour;
sch.StartTime = DateTime.Now;
sch.RemoteImageUri = new Uri(@"http://winmilk.julianap开发者_运维技巧ena.com/Tile3.png");
sch.Start();
}
The exception occurs specifically when calling sch.Start();
.
It's also happening whether I use interval or one-time updates.
Anyone have any idea on why this is happening?
Thanks in advance!
Doh, found the answer. Didn't add
<Capability Name="ID_CAP_PUSH_NOTIFICATION"/>
to the WMAppManifest.xml file.
A bit misleading, because the documentation for ShellTileSchedule says that it's updating the tile "without push notifications". At least it works now :)
I have had this same issue from not getting the properties of my schedule right.
If i set the schedule to "only update once" and then set its "interval" it errors.
If i remove the interval this issue goes away.
精彩评论