Tuesday, November 27, 2012

Background agent expiry in Windows Phone 8

In Windows Phone 7[.x] background agents would expire (stop working/running) if an app wasn't launched for 14 days. Today I noticed in MSDN that things are slightly different in Windows Phone 8:
There are a few cases where an app’s background agent will not expire or will be automatically renewed.
•   If the Tile for your app is pinned to the phone’s Start screen, the expiration time for your background agent schedule is automatically extended to two weeks whenever your background agent calls Update(ShellTileData) to update the Tile.
•   If your app is selected by the user to display notifications on the on the lock screen, the expiration time for your background agent schedule is automatically extended to two weeks whenever your background agent calls Update(ShellTileData) to update the lock screen.
•   If your app auto-uploads photos using a resource-intensive agent, the resource-intensive agent schedule will not expire as long as the user has enabled this feature for your app in the photos+camera settings page.

8 comments:

  1. Anonymous6:33 pm

    Do you know if a wp7 app running on wp8 has to reschedule?

    ReplyDelete
  2. Anonymous - I don't know about that scenario. I would expect they would. But if you were writing something that targets WP7 to run on both you'd have to write the code to restart it anyway. Even after discovering this I'm still planning on leaving the restart code in WP8 versions. It's not going to cause any problems being there and is still needed when not sending push notifications to update the tile.

    ReplyDelete
  3. Yes, but in my apps, I've been changing the tile to warn them to restart before the time runs out so they don't think it's broken.

    I'll have to detect W8 I think, and change my timeout date in that case, or at least not display the message.

    ReplyDelete
  4. Awesome tips.. I've learned a lot

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Great phone and great feature.... I like it

    ReplyDelete
  7. This is a great post. I like this topic.This site has lots of advantage.I found many interesting things from this site. It helps me in many ways.Thanks for posting this again.

    ReplyDelete
  8. I am impressed by the quality of information on this website. There are a lot of good resources here. I am sure I will visit this place again soon.

    ReplyDelete