Wednesday, June 02, 2010

Android Data Diet

A couple of months ago, I got myself a smartphone. No, not that one; something better. I got a Nexus One, Google's flagship Android phone. Though younger, Android is already significantly more capable than iPhone OS. It's also open source, Linux-based, and uses Java as its primary development language. Throw in the top-notch development tools based on Eclipse, and it was a total no-brainer for me.

Oh, and did I mention it's dead sexy?

I actually got my Nexus One while I was in California for EclipseCon at the end of March. Google sells the phone directly online (though they recently announced they're ending that experiment and pursuing more traditional sales channels), but I saved myself the costs of international shipping and customs duties by having it delivered to my hotel in Santa Clara and bringing it back with me after seven days in the US.

Since then, I've been absolutely delighted with it, but for one most unfortunate incident: A couple of weeks ago, my phone allegedly decided to eat through my entire month's data allowance in one day. My Telus bill shows over 450 megs of data on one Sunday, and I have no idea how that could have happened. Telus was, of course, completely unhelpful, refusing to share any information about which specific hosts or domains my phone was supposed to have accessed. That information could have helped me determine if and how that kind of data usage actually occurred, but Telus wouldn't even confirm whether or not they actually keep such information (even though Canadian privacy law requires them to, on request, inform an individual of the existence of all personal information and give him or her access to that information). Unfortunately, Android doesn't report data usage out of the box, and I hadn't even thought of installing an app to do that.

So, it's impossible for me to go back and find out what happened that fateful day, but it was immediately clear that I couldn't let it happen again. I was only about a week into my monthly billing cycle and was suddenly being charged 5 cents per megabyte of data. So, the first priority was to severely restrict my data use for the rest of the month. Beyond that, I'll need to put in place a strategy to prevent me from getting into this situation again.

The first thing I discovered was alarming, and it's my only real complaint about Android so far: by default, Android is configured to put Wi-Fi to sleep whenever the phone's screen shuts off, in order to save battery. So, while the phone is sitting at home, unused, it falls back to mobile data, instead. But just because the screen is off, that doesn't mean the phone's not doing anything. I had it configured to automatically sync my Gmail, calendar, and contacts, and to constantly refresh my Facebook and Twitter feeds. Though I wouldn't ever expect this kind of activity to result in 450 megs of traffic in a day, megabytes or even tens of megabytes are certainly quite possible.

So, the first thing to do was to disable this Wi-Fi sleeping behaviour, but for some reason, the setting is very well hidden. From the home screen, you'll need to navigate to Settings > Wireless & networks > Wi-Fi settings to find it. Then, you'll need to hit the menu button, and finally select Advanced. Only then can you switch the Wi-Fi sleep policy to Never. I would highly recommend every Android user do this, as unintentional data use can cost you money. I haven't experienced any noticeable effect on battery life, either: I'm still easily able to get through a day on a single charge. I really think Google selected a poor default, and I've told them as much in this bug. Hopefully, it will be remedied in the future.

Since I'm not always in a location where Wi-Fi is available, my next step was to try to disable all background data usage. All account synchronization can be turned off in one place, which is most convenient: Settings > Accounts & Sync > Background data. Once this is done, you'll need to synchronize manually, such as by selecting the Refresh menu item in the Gmail app. Also, this setting must be re-enabled temporarily in order to use the Android Market. I currently do both of these things only when I'm on Wi-Fi.

Finally, I went through all of my apps and looked for any settings related to background data use or notifications. For example, Seesmic has a notifications feature that relies on polling the Twitter server to update the feed. I disabled all such features, and now my data use has slowed to a trickle.

Still, there was something missing: I needed a way to track my data and be notified if it gets too high. Fortunately, there are at least a couple of great, free apps for data usage monitoring available on the Android Market. I'll talk about those tomorrow...

No comments: