iOS - what happens in the background?
04 Apr 2014

One part of Android that I’ve always thought is missing from iOS is good battery monitoring. Yeah, partly I just like knowing what’s going on, but it also gives you some visibility into battery problems. Phones have small batteries, so they get away with an all-day battery life because most of the time they’re idle and almost everything is off. The flip side is that unlike a laptop, a wedged process running in the background means serious battery drain problems.

To say Android is better equipped here would be an understatement

This problem is dodged by the system being agressive about what can run in the background, and when. But, it can still surprise you - it used to be that if you installed the Skype app, it sat in the background and chewed on your battery 1. Not to mention that with each iOS release, apps have more licence to run in the background.

What doesn’t seem to be well known is that there’s a way to do this without jailbreaking, using Instruments. Prerequisites are Xcode (and a Mac). You need to connect your device with a cable then set it up to work with Instruments, which you do just by opening Xcode with your phone connected 2.

In Instruments select iOS in the left panel, and the Energy Diagnostics template. To see what’s happening on your phone, hit record. In addition to the standard tools - CPU usage, Network activity - you can see when apps enter and exit running states via the flags at the top of the timeline. For example, Weather wakes up for a few seconds every time you unlock the phone.

More useful than just showing data when you’re connected to your laptop is that you can record diagnostics, and later review them in Instruments. Setting your phone up to work with Instruments adds a Developer menu item in Settings. To view the data, reconnect your phone then go to File > Import Logged Data from Device in Instruments.

  1. This was due to Skype’s decentralised architecture. See this email written by Skype’s Princial Architect and search for “hand warmer”.

  2. If you’re seeing this warning in Instruments, that’s probably the issue. The Developer-ness persists until you restart your phone.

Archive