Windows 10 UWPs to run in the background too, no agents needed

Published by at

One of the quirks of Windows Phone and then Windows 10 (Mobile and the UWP frameworks) was that third party applications had to live with handling 'background' operations via a separate process (agent), which had to run under very specific time and processor constraints. In most cases, this was made to work, but Microsoft is clearly listening to developers and have introduced new mechanisms for the Redstone release ('Anniversary Update') which mean that an applications main code is allowed to stray into the background, meaning that constructing a background agent may not even be needed anymore.

From the Windows blog:

Interested in running your application in the background? A new developer option available in the Windows 10 Anniversary Update just made background activity a whole lot easier. Your feedback was clear on the multiple process model: while doing background work in a separate process was more resilient, it required significantly more code to implement. From this feedback we are able to provide a new option, a simplified method for enabling background activity without creating a background task. Now developers have the choice of running code in the background as either a separate process or directly inside the foreground application. We’ll cover the basics for all the tools which utilize the single process model:

  • Background Triggers
  • App Services
  • Background media playback using Activity Sponsored Execution.
  • Extended Execution

...The single process model enhances the application lifecycle with improved notifications for when your app is in the foreground or in the background. Two new events are available from the Application object for these transitions: EnteredBackground and LeavingBackground. These events fit into the application lifecycle based on the visibility state of your application.

1_lifecycle

And so on - it's a lengthy blog post aimed at developers, but the gist is that third party UWPs on Windows 10 will be able to do more, especially with background media, and do it more seamlessly. As someone who's been struggling to control audio on my various phone, switching between the lockscreen controls, system media player controls and those in the application itself, a simpler workflow for the code has got to be a good thing.

Watch for third party updates using all this to start appearing from August 2016 onwards, though there will be the obvious requirement that the phones they run on have to be on redstone, i.e. the 14xxx branch of Windows 10 or higher.

Any comments from bona fide developers? I imagine this will help podcatcher devs in particular!

Source / Credit: Microsoft