Windows 8 Metro background task restrictions are way too strict (even versus Windows Phone 7!)
Mood: confused
Posted on 2012-05-08 13:43:00
Tags: windows rant essay windowsphone programming
Words: 548
Edit: See the followup post on why this isn't a big deal, and the right way to do updating live tiles in Windows 8 Metro.
I've been working on porting FlightPredictor to the shininess of Windows 8 Metro. One of the key features of FlightPredictor is the ability to pin a live tile for a flight, and have that live tile update periodically in the background.
On Windows Phone 7, there are a lot of restrictions on background agents like the one in FlightPredictor that updates the live tiles. The agent can't run more frequently than every 30 minutes (and when it actually gets called is not that regular), if it runs longer than 25 seconds it gets killed, and most importantly there's a limit to how many you can have active on the phone - Microsoft says phones must allow 6, but my Lumia 900 allows a maximum of 9. I've actually hit this limit, because live tiles that are always up to date are cool.
So, I've started to work on this for Windows 8 Metro, and I found this whitepaper about Metro background tasks. There are a bunch of new ways to trigger running tasks (when you have internet access, for example, or when a user logs in), but you can also trigger them every 15 minutes, which is nice. There are also CPU requirements (now they're measured in CPU-seconds instead of wall time that the task runs) as I would expect.
Unfortunately, you can't use the TimeTrigger unless you display information on the lock screen. This requires extra user permission, which is OK enough, I guess. I wasn't planning on looking into showing flight info on the lock screen, but if that's necessary for my app to work the way I want it to I'm fine with that.
But here's the kicker: a user can only have seven apps show information on the lock screen. And three of these (Mail, Calendar, Messaging) are builtin! So this leaves four slots for apps to run based on a TimeTrigger in the background.
Now for the rant-y part: this is crazy. I have a bunch of apps that run in the background on my phone - as I said, having auto-updating live tiles is one of my favorite features of Windows Phone. To drastically cut the number of apps that can do this on an OS that's designed for a tablet (so presumably better battery life, etc. than on a phone) is way too strict and a step backwards.
It is possible I've missed something here, and I'd love to hear feedback on it. This is just a policy decision - what I would really like is the ability to run based on a TimeTrigger even if my app isn't on the lock screen, with reasonable limits.
Addendum: one way around the limit on Windows Phone 7 is to use push notifications - then your app doesn't have to run in the background and doesn't count against the limit. But it looks to me from reading the Metro whitepaper is that even apps that want to run based on a push notification have to be on the lock screen. Or is there a way to use a push notification to update a tile without having an app run? I'm not sure...
3 comments
Comment from ext_1200663:
2012-05-09T10:30:57+00:00
I understand your frustration. I wish I had a more direct line to provide feedback but the best way right now is using the feedback tool.
https://connect.microsoft.com/site1147/Internet%20Explorer%20Program
I will try to raise this internally as well.
Finally, you shouldn't have to respond to any triggers or be on the lock screen if all you want to do is update your tile or pop a toast using Push Notification Services. Here are examples of how to do that:
http://msdn.microsoft.com/en-us/library/windows/apps/hh465450.aspx
http://msdn.microsoft.com/en-us/library/windows/apps/hh761487.aspx
Comment from ext_1200663:
2012-05-10T00:58:47+00:00
Here's how to update a tile every half hour without being on the lock screen. It does require that you have at least a simple web server able to return some XML.
http://code.msdn.microsoft.com/windowsapps/Push-and-periodic-de225603
Comment from gregstoll:
2012-05-14T17:44:51+00:00
Thanks! Yeah, these make a lot more sense. I'll post a followup post soon.
This backup was done by LJBackup.