Monday, June 14, 2010

How background works in iOS4

Background Apps
iOS4 has several classes of background apps. Unfortunately, IM is not one of those classes. The classes that do exist are for essentially for voip (network socket maintenance), audio (audio processing) and location services (full multi tasking) .  Having run Monal in the background for a few weeks and seen the battery life, I now understand why Apple has done this.  You are always aware of  and interacting in some way with all of the classes of background apps allowed. You are either making a voip call, listening to audio or using the GPS navigation. At no time do any of these background apps run  with the user not aware of it. IM on the other hand is expected to run at all times.  It runs silently in the background, using the cpu ,  keeping a connection open and generally draining the battery. It is entirely possible for someone to run an IM app, not be aware it is running and then begin to wonder why the battery only lasts a couple of hours.  I have seen this happen time and again to android users. Power users may be able to use the task manager to kill processes, but that is unreasonable for a mass market product.

How Monal Works
All of that being said, Monal does run in the background and the way it does it should satisfy the needs of most users.  Monal runs in the background for 10 minutes. After 5 minutes of idle time, it will push a notification that only 5 more minutes of background time remain.  After 10 minutes, the program will logout and suspend itself. A suspended program is not a drain on the battery.  If at any point in the 10 minutes you bring Monal back to the foreground, the clock will be reset for a fresh 10.

When Monal is running in the background, it will push notifications to the user when messages are received.  The user will view/reply to the message and thus continuously reset the 10 minute clock.

I think the typical user would sign in and  move Monal to the background and do other things. They either send and receive messages  and continuously reset the 10 minute clock or  at 5 minutes are asked to renew it for another 10 minutes by brining Monal the the foreground once.  This prevents the scenario where someone signs in  and forgets to sign out, locks the phone  and then completely drains the battery. 

What if someone wants to stay signed in while the phone is idle ?
If you want to remain signed in while not using the phone, move Monal to the foreground before locking the phone. If you do this you will always be signed in and will receive notifications for all messages. When you want to use the phone again you can move it to the background and renew the 10 min lease periodically.


  1. Can you make this work on iPod touch 2nd gen (with iOS 4.0) like the Meebo app can (Meebo was even able to do this somehow on 3.x).

  2. clients that use push notification in 3.x or in iOS that does not have multi tasking are not running on your phone. It requires you giving your login information to a 3rd party so they can run the program on their servers

  3. How about having an advanced option foe power-users that do understand the down sides of letting IM run in the background all the time?

    Also, isn’t it possible to really make the client light weight when running in the background? Some optimalization should be possible here.

  4. i'd love to see an option to disable the 10 minute limit as it makes it unysable for me - i use it more as a constanly running pager...

    Anyway thanks for a great client!


Note: Only a member of this blog may post a comment.