A few days ago, Microsoft posted up a new entry in its Windows 8 app developer block on how Windows 8 Metro apps can be coded to perform tasks while still running in the background of the OS. This week, the company posted up a new entry in the blog that offers up two examples of how background running apps can still be productive.
One example discussed was allowing background apps to run and accomplish tasks while a Windows 8 device is plugged into a power outlet, rather than running on battery power. Microsoft said that Windows 8 app developers can put in this kind of feature using what is called a maintenance trigger. The post explains:
The maintenance trigger is available to everyone and your app doesn’t need to be on the lock screen. The advantage of using a maintenance trigger background task is that it is guaranteed to not interfere with the user’s activity and, runs only on AC power. So you don’t need to worry about excessive battery usage.
Some example code is put into the blog on how to code in this maintenance trigger.
Yet another example is offering to give app users a way to give Windows 8 apps permission to run in the background while also appearing on the lock screen. The blog states:
This is a natural fit because the lock screen is designed to provide users info about their apps without the need for them to unlock their Windows 8 device. This relationship is a two-way street: your app can use these types of background tasks only if it is on the lock screen and, likewise, your app can appear on the lock screen only if it requests to use these types of background tasks.
Apps that might be a good fit for lock screen permissions include email clients which can show a number of unread emails to the user. Again, the blog offers up some example code to developers to show how a background running email app can download new emails from a POP account every 15 minutes. The blog also goes into some detail about how background apps do still have some CPU and network resource usage constraints and goes over those specific limits.
Source: Microsoft | Image via Microsoft