Facebook app is draining your iPhone’s battery

The last few weeks my beloved iPhone 4S lost battery extremely fast. After a normal work day there was hardly 10% left. That means after 12 hours and little usage of the iPhone.

So I went on to find the cause. As an iOS developer I know Instruments form Apple’s developer tools. Instruments is mainly a tool to benchmark your own apps, find slow parts and fix memory leaks.

But Instruments can show the running processes on your iPhone, too. It’s just like Activity Monitor on your Mac.

There is this nice overview and something caught my eye:

That is a list of processes using the most CPU time. Or more easily said: that are the apps that have been running the longest time. The first four are system processes (SpringBoard is essentially the thing that shows your home screen and stuff), at the bottom there is the Facebook app. It is using twice as much time as DTMobileIS (that is the process that feeds Instruments with live data from the phone). That seemed a little much to me. I’m using Facebook quite often, but not like every minute of the day.

So I let Instruments run a little longer and watched the flags.
The flags indicate when an app is getting started, getting terminated and what interested me the most: when it’s getting send to the background and when it’s getting suspended.

To understand that I have to start from the beginning:
If you start an app, then it’s running in the foreground. Sure. If you press the home button, the app is not getting terminated but it’s suspended (the app is sleeping). If an app is sleeping it is frozen and is doing nothing (not using any CPU time), although it is using memory. But that’s a good thing: so if you return to that app it’s faster available, because the system does not have to start it, but simply unfreezes it. Apps can be terminated when frozen (either by the system when memory is running low or by the user using the multitasking switcher, which is normally not necessary).

Since iOS 4 there is multitasking. With that it’s possible for an app to keep running up to 10 minutes after being sent to the background. This is very handy for apps like Instacast, which can finish the podcast downloads in the background (in the past you had to leave the app open until finished) or for my app Home Remind which is sending your reminder in the background. That is no big deal and iOS freezes these apps after 10 minutes at the latest or when the app says it’s done.

Unfortunately some apps are exploiting this. WhatsApp for example. When it seems like it’s terminated it’s actually running exactly those allowed 10 minutes and continues to communicate directly with it’s server instead of using iOS‘ push notifications. That’s draining more battery, of course.
So if you are getting a message in this 10 minute timeframe and open WhatsApp, this 10 minute period starts again. That means if you are getting lots of messages it could happen that WhatsApp is running the whole day. Thankfully most of us are not that popular, so this would become a problem.

Additionally to this 10 minute background time there are four more multitasking modes. They all have something in common: they are running indefinitely. But more important they are defined by the apps themselves.

These four modes are:

  • Playing audio: for apps like Spotify/Pandora who play music when you are doing something else
  • Location based apps: this is for your navigation apps like Garmin or TomTom
  • Newsstand downloads: Newsstand apps can download new issues in the background
  • Voice over IP apps: this is for Skype and apps that allow to phone someone, they run in the background waiting for calls

Let’s return to our case: Facebook.
As said before the app is defining what it’s using. Facebook is using two of them: Audio and VoIP!
VoIP since you can call someone via Facebook and Audio is mandatory for VoIP apps: „Most VoIP apps also need to be configured as background audio apps to deliver audio while in the background. Therefore, you should include both the audio and voip values to the UIBackgroundModes key. If you do not do this, your app cannot play audio while it is in the background.“ Source

That means the Facebook app could be active in the background the whole time.
According to Instruments that’s not the case. Not quite.
Looking at the flags in Instruments you can see that the app is waking up every few minutes, does something for 10 second and sleeps again.

I let this run for two hours and as you can see in the rightmost column, the Facebook app is waking up at regular intervals, does something for almost exactly 10 seconds and sleeps again. The whole day long.

This explains why this app is in the first place in the CPU time listing.
Theoretically the app could use your location when awake and send it to Facebook, but I found no evidence for that.

After this discovery I searched for a way to disable this background actions. So I thought: you can disable the chat inside the app. Probably the app is just running because it is waiting for calls.

So this is the result with disabled chat:
Chat aus

As you can see there’s no difference at all.

Except for that I have found no other setting that has changed anything about this behavior.

So it seems there are only two solutions for this problem:
1. delete the Facebook app
2. quit the Facebook app after every use with the multitasking switcher (press the home button twice in a short time, then you see a bar showing your apps, tap a little longer on one app and they start to shake, now hit the little minus on the Facebook icon)
Now the Facebook app is really terminated and is not running in the background any longer. But if you forget the terminate the app at least one time, it’s running in the background again.

I’m currently using the second method. Since then the Facebook app is no longer in the list of the biggest CPU time consumer and my battery is lasting longer.

A better solution would be if Facebook changes its app to not use so much battery. I don’t see any reason at all why that app has to run every few minutes.

Just try for yourself and comment if you see any difference in your phones runtime.

P.S.: I’ve tested this on two different iPhones, so it’s clearly not a problem of my phone.

P.P.S.: I’ve run that test again on the Facebook Messenger app and on Facebook’s iPad app. The results are the same. They run every few minutes, too:
Facebook Messenger

iPad App:
Facebook iPad

This article is a translation of the original article which was written in my native language German, so please excuse any mistakes.

Please share this article! Together we can get Facebook to fix their app!

Update: Facebook updated its app on June, 18th to version 6.2 but that did not fix this problem.

Update 2 (11/26/2013): Facebook did not change anything, even the current version 6.7.2, released 11/13/2013 is running every 15 minutes for 10 seconds. Same is true for the Facebook Messenger 3.0.1, released 11/18/2013. Just sad.

Update 3 (02/21/2014): No news here. Yesterdays version 7.0 of the Facebook app does not change anything. 🙁

Update 4 (03/18/2014): Version 8.0 of the Facebook app is still running in the background, BUT if you turn background refresh off for Facebook in the system settings it is not running in the background anymore!

Comments are closed.