As much as you might love an app, you can’t have it running front and center all of the time. When you have to toss an app into the background to work on something else, it’s important that the code behind it is ready to shut down or otherwise inhibit key processes in order to cut down on memory usage.
The Windows 10 Anniversary Update is going to be adding a new option that’s going to make running apps in the background a lot easier, according to a recent Windows blog post. The addition of new background triggers (which take the form of the EnteredBackground and LeavingBackground events) is going to make a world of difference for developers trying to better optimize the memory usage of apps, and the differences will be noticed by users who have lower end computers, or just need to run a whole lot of programs at once.
Here’s the gist:
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 blog post provides a great deal of detail on how to implement the new background triggers, including code snippets and unsupported scenarios. If you’re a developer, check out the new capabilities coming in Windows 10 Anniversary Update and let us know in the comments how this will help you write better-performing apps.