WP7: Background execution – really?

One of the major complaints on the Windows Phone 7 platform is that you can’t run third party applications in the background. I had the same complaint on iPhone for a long time but over the time I have started to think about the problem and I’m not sure background operation for third party application is the only way to solve all the problems.

Let’s look at two scenarios that I think are the most common for background operation: Music player services like Spotify or Last.fm and GPS related applications like the RunKeeper GPS tracker. In these two main scenarios I think a richer and more service oriented API within the phone could take care of the problem instead of background execution.

Lets focus on the audio service first

No doubt that you need it to continue playing music while you work on other stuff. That’s not what I suggest but instead I want you to think of the application that is native in the phone, the Zune media player. Why would I want to create a new player over and over again? Wouldn’t it be better to integrate with the current? If the API was richer, in the Spotify case it would be possible to:

  • Plug in the codec + DRM that’s used in Spotify
  • Create and use playlists from either streamed material or locally stored material – or both
  • Update the background image and access to all the data that is visible in the player
  • Add the playlists as your own into the Zune player and for example mark them with a Spotify icon fro branding

The benefit with this would be many: Apart from not taking up precious development resources for cloning the Zune player over and over, you could let Microsoft take care of creating the most effective background enabled audio/video player.

To the user there is also the benefit of using the familiar way of navigating the audio as always instead of a new one for each application.

Now over to the GPS application

Why do you need to run this in the background? Well there are lots of reasons, but mostly it’s to be able to track and later plot your location from the track you are currently running. This functionality could also be handled with a service similar to the audio service. Why not trigger the GPS service to start tracking and storing the points. This would actually give even more advantages. This way two GPS enable applications could be using the same GPS track store and bring up the points. Again this would let the developer focusing on delivering an awesome application and not how to handle the GPS API effective enough not to drain the battery.

Moving on to task scheduling

There are of course situations where this approach won’t solve your issue but it’s good start to think in other directions when it comes background execution. Why not support some kind of task scheduling instead of true background operation. Here’s an example of what I mean:

In the GPS tracker situation there is an other issue that should be solved. The RunKeeper application vocally reports information on speed, average speed, distance, etc. This would normally be handled with an application running in the background. But it would also be possible to let simple tasks or code snippets be triggered with a set of rules based on the GPS tracker, like time, speed or distance.

I wouldn’t call it multitasking as the application isn’t really running in the background. It is just providing the code that should be brought back to life on certain points and then go to rest again, it can even be fully exited instead of suspended. To the user it would be of no difference if the application is running, suspended or exited as long as it behaves as if it was running in the background.


I think that in many situations we tend to take the obvious solution. While an alternative and for the user actually better way can be achieved if you think twice about it.

And there is an embryo to this in the Zune application, you can let your application launch the Zune player with a URL (either a net stream or locally stored) and it works great. But the API needs to be richer as I would want to insert Metadata and create lists for this as well as be able to provide a codec for handling media streams that Zune cannot play out of the box.

The market will continue to demand background enabling, and Microsoft will probably support that sooner rather than later but I really think we would all benefit from this thinking, both as developers and users.

This Post Has 11 Comments

  1. Fredrik Olsson

    So basically you want the same support for background tasks that was added to iOS 4?

    Just add VoIp apps to the list of app-types with special needs. And then an app need to tell the OS that it would like some more time to finish something before it is terminated/frozen, for example finish an upload.

    1. Håkan Reis

      @Fredrik: I haven’t looked into how iOS does it. The main part especially in the audio case is to use the built in player. I can understand that you want to brand your player (like in the Spotify case) but for the user its better to have a uniform way of accessing the player.
      When it comes to the GPS and other stuff… we should talk :)

  2. Johan Thiborg-Ericson

    I’m sure the developers at Spotify are dying to implement a decent API for their player, or more likely, it already exists. But they know that if they released it someone would find a way to bypass the commersials within half an hour :)

  3. Himanshu Rathore

    sir i wanted to reverse a string in wimdows phone7, how can i do this, ie..
    input box – “you are intelligent” (user type this in the input box)
    press enter. (user presses enter)
    ouput box display – “tnegilletni era uoy” (will be displayed to user)
    please help me

  4. Himanshu Rathore

    thankz ..sir..by the way i got the sol.. and i did complted the appl.
    i am also thankfl to yu since taught me a new way to search via google..intersting one. LMGTFY..ha ha ha

  5. Johan Karlsson

    For iPhone it is actually GPS, VoIP and streaming audio applications that are allowed to be executed in the background.

    As you imply with the task scheduling, background tasking is not needed in all cases. On iPhone you also have the possibility to use remote push notification to bring your application to life again. Does the WP7 platform have support for something similar like push notifications?

  6. Håkan Reis

    @Johan: There are three types of push notifications on the windows phone 7.
    – Toast notification shows a message on on the top with a message.
    – Raw notification that only reaches a currently running application.
    – Tile notification that can update the title, count, background image of a tile (the big “icon” that are pinned to the start screen of the WP7).

Leave a Reply