Friday, March 20, 2009

Background processes on Android

I’ve been working on an android application for a Special Topics class here at UMich. I chose the android platform for the app, because it offered me one great asset: background processes. I had to give up the much larger user base of the iPhone just for this. (Well, there’s also the fact that android is open, java based etc etc etc).

It’s now coming to that time of the semester when I’ve got to stop procrastinating and get started on the app. I now also have an Android Dev 1 device to play around with. So with all of that in mind, I decided to do get to work. First, I wanted to see how well background processes integrate into the android framework, so I downloaded a few generally useful applications to test this. I tried: meebo (for IM), and twidroid (for twitter). I very quickly found that these apps integrate into the android system beautifully. They use the notifications area to display alerts and also use the phone’s vibrate/LED/ring tone features to alert me. I was very encouraged by this. That’s when I hit the snag.

Most of my testing was being done at home and on campus (which is where I spend all of my time). Both places have access to Wifi networks, and therefore I was using those instead of the much slower EDGE network (no T-Mobile 3G in Ann Arbor yet). The result was that the first time I pulled the phone out of my pocket to make a phone call, the battery level was critically low. I was pretty shocked by this considering that I’d charged the phone overnight, and it had been on for barely 2 hours. Initially I thought this was a one off thing, maybe the charger had been unplugged accidentally or something. But, turned out that was not the case since it happened 3-4 times repeatedly. That’s when I thought it was because I was using Wifi all the time. So, I turned off the Wifi and started using EDGE instead. This helped significantly. The battery life went up to roughly 4-6 hours (keep in mind that I’m not much of a cell phone user – I made/received approximately 1-2 calls in each period). Still, this was really no good (who charges their phone every 4-6 hours).

Having seen this I started playing around with the apps themselves. Meebo pretty much has to run continuously and use the network. I thought this might be the root cause of the problem and turned meebo off. I also set twidroid to look for updates every 1 hours instead of every 5 minutes. And voila! I haven’t charged my phone for over a day, and the battery level indicator is still showing well above 50%.

This led me to the following belief: running background processes on a cell phone is simply *not* a good idea. The drain on battery life that it poses is absurd.

As if to prove me right, Apple said the very same thing at the preview of iPhone OS 3.0. They said that background processes reduced battery life by roughly 80% even if the phone was not being used. They cite this as their reason for using push notifications instead. I think they’ve got it absolutely right on this one. While it’d be amazing to have background processes, as things stand, they’re of no real value. I’d much rather have push notifications.

Afterthoughts:

1. It’s pretty obvious that push notifications are a better way of doing things (given current technology). But, there are some uses of background processes that push notifications can’t handle. It turns out the app that I’m building is one such use. What if you need to constantly receive the phone’s location (via GPS, say)? There’s no way you can do that with push notifications. If you know a good solution to this problem, please let me know :)

2. I didn’t mention earlier that the android system keeps your contacts, gmail and google calendar in sync (almost instantaneously). I also have the phone set up to receive my UMich email via IMAP (also almost instantaneously0. Somehow, this doesn’t seem to drain battery life at all. Is it just the case that the applications I chose are badly written?

 

- Sir Lapog Kahn.

Sunday, March 15, 2009

Meebo

I’m sure most of you have heard of meebo.com, or use it actively. If not, check it out now! We all know how awesome Meebo is. What may not be all that well known, is that there’s an Android application by Meebo. And it’s awesome!

It works the same way as does meebo.com, except, since it’s a native application, it integrates really well with the Android OS. It runs as a background process when you close it, so you can receive IMs even if the meebo application is not open. This is really cool, because now I can stay signed in on my phone all the time. Not something I can do on my iPod Touch.

The app has support for everything that’s supported on meebo.com. You can still login with your meebo id. The app’s well built (has yet to crash on me), and like I said before, integrates really well into the phone. Plus, it’s free.

Bottom line: if you’re an android user, you should get Meebo yesterday.

- Sir Lapog Kahn.

Android Dev 1

I’m currently in a class that’s about developing applications for the iPhone/Android operating systems. My team and I are working on an application for the Android.

For several reasons, we stayed off the iPhone. The most important one is the closed-ness of the iPhone. I have several rants to make about this, but I’ll get into them some other time :)

To help debug and test our application, I recently got an Android Dev 1 device (the University is paying for it, so whoo!). This is the same HTC G1 handset, but shipped to registered Android developers only. It’s unlocked, which means you can put in a SIM card from any carrier, and it will work. The idea is to have developers be able to test/run their applications on a device, without having to get a contract with T-Mobile. (Of course, this can’t be done with the iPhone, so boo!).

Couple of quirks with the device though. It *needs* you to have a data plan enabled SIM card. It can be from any carrier, but it must have a data plan, even if you only plan on using the WiFi connection. From what I’ve read, you can boot up the phone with such a SIM, take it out, and all future boots should work without a SIM card. But, since I got a data plan on my TMobile SIM anyway,  figured I’d make the Dev 1 my primary phone.

Second quirk: (sorta, not really) you need to have a google account linked to the phone. This way it syncs your contacts, gmail, gtalk, etc to your phone automatically. This is 2 way sync, btw. This feature is really awesome and I would’ve done it even if it weren’t required, so it’s all good.

I’ve been using the device for a couple of days now, and it’s been awesome! I actually like it much better than my iPod Touch. Except for the fact that you can’t use standard headphones, which basically means I can’t use it for music. I loathe the provided headphones. As to why HTC did this, is a mystery. It makes *no* sense. Also, the phone gets really hot, is heavy, and runs of battery insanely fast.

Things I like: background processes mean I can run a host of interesting applications that couldn’t possibly run on the iPhone OS; Physical keyboard means I type much faster, without losing screen real estate. There’s a bunch of other stuff, but those 2 are the big ones for me.

As I use the device more, I’ll be sure to keep updating the blog with my opinions. Watch out.

- Sir Lapog Kahn.

A New Beginning

Once again, I have decided to start blogging. It’s one of those things that I decide to do everyday, but never get down to actually doing. This time, I sincerely hope that I keep with it. In order to actually make this work, I’ve decided to change my blogging style and keep my posts very short and specific. So, here goes!

-Sir Lapog Kahn