19

If I start a Modern-UI app and then switch to a different app or a normal program running on the desktop, what happens to the first app? I've heard something about the first app being suspended, but realized that I don't really know that for certain.

I mean, could you write a SETI@Home (BOINC) app if you wanted to, or will apps that aren't in the foreground always be suspended? Can you change that? I could see changing that based on available resources, running from AC vs. battery, etc.

This morning I heard about an iPad being recovered thanks to the "Find my iPad" app, and was wondering whether you could write such a thing as a Modern-UI app and have it work without being the running foreground app. (I'm aware that you'd just write a Windows service or similar, that's not what I'm asking about.)

Insane
  • 2,892
  • 6
  • 26
  • 49
Mark Allen
  • 2,901
  • 1
  • 22
  • 23
  • 1
    The comparison with the Find-my-iOS-device-App is irrelevant; since the iOS vendor (apple) can allow it's iOS Apps whatever it wants. I'm considering to remove it from the question to avoid confusion. What does anyone else think? – kluka Nov 13 '12 at 18:51
  • @klyonrad It was relevant to me as it's the only reason I asked this question to begin with and provides an example of why someone might care in the first place. I would strongly prefer that you leave the question alone. – Mark Allen Nov 14 '12 at 00:05

1 Answers1

23

If I start a Modern-UI app and then switch to a different app or a normal program running on the desktop, what happens to the first app?

The app enters a suspended state — you can check its resources in task manager.

Apps will be suspended when you are not using them, this is for performance. When suspended you won't feel your system 'lag' (ie slowdowns attributed to running an intensive application in the background).

Windows 8 is designed to keep in mind that when any background app is not active, it should not use much CPU, so your system performs well in the active app.

Any Metro style app is in one of 4 lifecycle states at any given time:

  • Not Running
  • Running
  • Suspended
  • Terminated

As the app transitions between states, it receives lifecycle events that help provide a consistent and high performance experience to the user.

enter image description here

There are some MSDN blogs which can help you to implement what you want to.

Managing app lifecycle so your apps feel "always alive"

Being productive when your app is offscreen

Being productive in the background – background tasks

Glorfindel
  • 4,089
  • 8
  • 24
  • 37
avirk
  • 15,689
  • 16
  • 59
  • 104
  • 1
    Why is downvote? Please care to comment so I could improve the post. – avirk Nov 09 '12 at 03:50
  • This answers my question, thanks! (and I up-voted it too, don't know about any down vote.) – Mark Allen Nov 09 '12 at 04:21
  • @avirk What happens if I am downloading some apps from the store and it's running in the background? Are the apps still being downloaded or do they get paused? – mr-karan Nov 09 '12 at 09:06
  • 3
    @thetechfreak they will continue download without suspend, Windows is using a `BackgroundDownloader` which will not pause the download when your app is not in foreground. Also you can download/upload without any interruption when your app is not in foreground. – avirk Nov 09 '12 at 12:52
  • 1
    I especially appreciate the links - I feel much better about modern-ui apps now. – Mark Allen Nov 09 '12 at 19:26
  • Many people know about the suspended-state now. I am wondering about more details; what kind of stuff exactly the Apps are allowed to do and how long etc. – kluka Nov 13 '12 at 18:54
  • @HaydnWVN thanks for keeping an eye on my answers and for improve them. Lol :P – avirk Nov 14 '12 at 13:10
  • Not a problem, just a shame there's not much points in editing :( – HaydnWVN Nov 16 '12 at 08:22
  • 1
    @HaydnWVN don't worry! Edit 500 posts will be a gold. :) – avirk Nov 19 '12 at 15:01
  • Get posting then! ;) – HaydnWVN Nov 19 '12 at 15:17
  • @HaydnWVN I can't post too much. lol ;P – avirk Nov 19 '12 at 15:19