I got hit by the mysterious overnight battery drain that’s been affecting G2 owners over the past week or so. Without using it at all, it had dropped to 58% battery. No, I haven’t received the OTA update to Gingerbread yet. Reports have been that it might be related to a Google Maps update that came out last week. Seeing as how I checked the battery usage and it showed 91% was Maps, and I hadn’t used Maps since several hours before I plugged it in last night, that seems highly likely.

I figure there are two reasons it hit now and not earlier.

  1. I usually charge my phone overnight and unplug it in the morning, though the last few days I’ve been charging it in the evening and unplugging it when it’s done. And since I usually use navigation to check traffic on the way to work, I tend to recharge it during the day because actually using navigation is a battery hog. You’d still expect it to have hit yesterday or the day before, except…
  2. I usually turn off GPS when I’m not using it. Last night I forgot.

My guess: Maps isn’t shutting down properly, and if GPS is enabled, it’s calling out and using up power.

The other weird thing: Before I realized I’d left GPS on, I uninstalled updates to Google Maps. Then I went back to the battery usage report, and instead of 91% Maps and tiny percentages of others, it showed the more typical 30% Cell standby, 30% Wi-Fi, etc. I suspect uninstalling the updates may have removed it from the battery usage report, and I was seeing the remaining 9% blown up to 100%.

Update (Wed): I reinstalled the Maps update and made a point of turning off both GPS and Wi-Fi when I charged the phone that evening. No battery drain during the 8 hours between the time I unplugged it last night and the time I picked it up this morning. Tonight I’m going to try it with just Wi-Fi and no GPS and see what happens.

Update (Fri): Well, that was unexpected. I turned GPS off and left Wi-Fi on last night, and the phone was down to 55% battery when I woke up this morning. Even though I know it had a stable signal since it was sitting 4 feet away from the access point. I would have thought GPS was a more likely culprit, but this suggests otherwise. Tonight I’ll have to try it the other way around.

Update (Sat): Last night I turned off Wi-Fi and turned on GPS before unplugging it from the charger. This morning I forgot to check the battery level, but I looked at it just after noon — and it’s still at 90% after at least 12 hours.

To make matters more interesting, Katie has long had problems with her Vibrant losing battery quickly, but since she turned off Wi-Fi, she’s been able to go several days between charges.

I think we’ve found the culprit. The question remains, though: why now? What is the phone doing over wifi that it wasn’t before?

I’ve never been a fan of actually using GPS navigation. Sure, I’ve always thought it was insanely cool that it was possible, I just didn’t want to use it myself. For unfamiliar destinations I generally prefer researching a route first, and for familiar ones I generally prefer just relying on my local knowledge. But I’ve found something that I do like using it for: Traffic.

I recently started a new job, exchanging a fairly short commute for a ~40-mile trek across the Los Angeles freeway system. Under ideal conditions, it’s about 45 minutes. When the freeways are bogged down (i.e. when I’m actually going to be driving), it can take an hour and a half or more.

When I landed the job, I replaced my phone with a G2. It’s a heck of a lot faster than my old phone, plus it can handle newer software…like Google’s turn-by-turn navigation app for Android. After trying a couple of different routes the first few days, I tried it out…and discovered that it factors in live traffic data when calculating the remaining time.

The upshot: I can walk out the door, start up the app, and figure out which of three main routes will get me there fastest. (Well, least slowly, anyway.)

Of course, it’s not perfect. It’s based on traffic now, and over the course of a predicted hour-plus, the route could easily get more congested. That’s not even counting potential accidents. It does seem to update frequently, though, and knowing I’ve avoided a 100-minute drive in favor of 70 minutes really outweighs the annoyance of a mechanical voice telling me how to get to the freeway from home.

I do have to remember not to rely on it too heavily at the end of the trip, though. I left it on by mistake after selecting my route to the LA Convention Center for Adobe MAX this morning, and instead of turning it off, I let it direct me straight past the parking garage.

Oops.

A few years ago, I tried to give some of my most-used websites a nice, clean look on mobile browsers by adding a stylesheeet with the “handheld” type. Then the iPhone came out and ignored them, and everyone copied that behavior, making it useless.

Somewhere along the line, I revisited the same CSS techniques, but used the “max-width” media query to change the layout on smaller screens. This seemed even better in the long run, since screen size matters more than whether a device is a desktop computer or a handheld computer. (The iPad was nothing but a long-standing rumor in those days, but demonstrates this clearly.)

The raw screenshots (click to view) are slightly larger, but since mobile devices often have denser screens, if you’re reading this on a desktop, it’s probably about the same physical size.

That worked great on the iPhone, and on the G1, which I updated through Android 1.6. I stopped testing it after a while, and no one commented on it, so I figured it was still working. (Reminder to self: that’s always a mistake.)

Last week I got a G2, which came with Android 2.2. Last night I visited one of my websites, and was presented with this shrunken, unreadable mess…because Android doesn’t actually use the real screen size anymore. It pretends it has a bigger screen so that it can present a desktop-like view and then let the user zoom around. Mobile Firefox does the same thing.

<rant>Why is it that every time I find a clean technique to use the same markup on both desktop and mobile devices, some browser manufacturer decides to bypass it in favor of giving the user a clunky imitation desktop view instead of one optimized for their experience?</rant>

*ahem*

Anyway, it turns out it’s possible to fix this problem with the <meta viewport tag> as shown here:

<meta name="viewport" content="width=device-width">

So I can provide nice, clean small-screen layouts again…after I add extra markup to every single page that uses these stylesheets.

Problem solved!

Well, almost. It fixes the layout…but it also prevents the user from zooming out for quick scrolling, which can be awfully useful on a long page.

Screenshots of the Barry Allen Flash profile, taken using the Android SDK emulator with stock Donut and Froyo images.