Facebook app is draining your battery

Facebook 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.

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.

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 or
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.

UTC

23 Oct 2017 - 09:47

Who's new

  • Joris
  • OCS
  • locje
  • Charlotte
  • Rutger Westen
  • Martijn van Beek
  • FUH
  • Rozemarijn
  • Eveline
  • Kevin Verburg

"No taste..."

"The only problem with Microsoft is they just have no taste."

* Steve Jobs in 'Triumph of the Nerds' (1996)

Crew Onboard

There are currently 0 users and 19 guests online.

Recent comments

Popular Callsigns

Disclaimer

TRApple.nl is 'Affiliate Free'  We are totally independent and have no affiliations with Apple, Boeing, TESLA or any other gadget provider what so ever. We reserve the right to refer to ourselves as ‘we’ and be as partial as we like. If you don't like that, stop consuming our bandwidth.
Have a good flight...

Company Freq.

You're not permitted to post shouts.
Willem-JanSinds 2 dagen werkt iTrans niet meer bij mij, is er een update ?? gr, WJ17 May 2017 - 08:24
Willem-JanGoedemorgen all,17 May 2017 - 08:24
KoenBeste trapple, Heb sinds kort een one plus 3t met android versie 7. Als ik in de standby app een datum wil selecteren dan sluit de app zich. Daarna moet je alles weer invoeren oftewel de app is niet te gebruiken. Groetjes, Koen Schimmel11 Feb 2017 - 11:17
AwesomeThx, Cees, for your donation to keep TRApple & eTRA safe and stable.27 Mar 2015 - 10:33
Awesome@steven: http://trapple.nl/content/agenda-niet-te-zien19 Feb 2015 - 18:53
X