Sunday, February 08, 2009

Android Fun

On Friday I got myself a nice shiny new T-Mobile G1. Also known (incorrectly) as the GooglePhone. It's pretty darn good. Well, unless you expect the battery to last the day when you're playing on it constantly because it's your new toy. I imagine that once I'm using it 'normally' instead of intensively, it won't be quite so bad. But I'd certainly say at the moment that the battery life is atrocious. Oh well, I was expecting that anyway. Onwards and upwards. It's otherwise a fantastic little device, and has enormous potential.

And it's easy to programme. I used to try to programme my Nokia phone using Symbian. But the number of hoops I had to jump through in order to get anything to work totally put me off, and I never got futher than writing a programme which said 'Hello' on the screen. (I guess 'Hello World' wouldn't have been much more effort, but by that time I'd had enough.) But programming Android is very easy. At first it was a little awkward, because on my six year old laptop (yes, six years old) the emulator was very slow, and used nearly all my computer's memory. But now I have a real phone I can plug the USB cable in and run and debug my programmes directly on the device. And from Linux too, which is pretty good.

I'm currently working on a little programme which will log sensor values to a file. Then I'll be able to plot them on a Google map and see how fast I was travelling and how hard I was accelerating or cornering. Not because I drive 'that way', but because I've always thought it would be interesting to log stuff like that, and now I have a device which can do it. So far I've just written a test programme which shows the values of the various sensors and moves sliders around, but it's been incredibly easy to do.

And just in case there's anyone reading this who wonders how I got the debugging to work in openSUSE 11.1, here's how. (Bear in mind that this is additional info to that which is in the SDK - it doesn't really make sense on its own). I created a file called 50-android.rules in /etc/udev/rules.d containing this line:

SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666", SYMLINK+="android_adb"

Then I chmodded it to 755, and, as root, ran 'adb kill-server' followed by 'adb start-server'. Then I ran 'adb devices' to see if the device showed up in the list. If it didn't I killed and restarted the server again until it did. (I don't know if I need to, or if I could just wait.)

After that, I was able to run and debug programmes from Eclipse directly on the device. Although I had to make sure that the manifest file had debuggable set to true, otherwise it didn't work.

4 comments:

Enderandrew said...

Just so you know, the G2 is basically done, but now is being held back to April. It will feature an OLED screen with much higher resolution, while consuming much less battery.

It was initially going to come out at the end of January, but the phone was so good, that Sprint and Verizon signed contracts to grab it from HTC and Google as well. So, now it is being pushed back to launch for T-Mobile, Sprint and Verizon at the same time in April.

If you can't wait, then keep the G1. If you want a much nicer phone, I'd return it and wait for April.

James Ots said...

I'm very happy with my G1, and I also want to play with it now. Especially since I won't get to play with the phone so much once our baby arrives in May. And I've heard the G2 won't have a physical keyboard, and that's a deal breaker for me.

I could keep waiting for a better phone, but I'd be waiting forever, as there's always something a bit better just around the corner. I have a 12 month contract though, so in a year's time I can get whatever is the latest, greatest at that time.

Unknown said...

I'm about to also buy one. Is it possible to let it sync with some KDE PIM environment? I don't want to store my calendar and contact at Google's.

What about the battery life? Is it usable for every-day needs? :-)

James Ots said...

@Johannes: I've just written a new post which probably answers these questions. It sounds like it probably isn't the phone for you, due to the tight coupling with Google. And I'm not sure about syncing with KDE - I was thinking about looking into it, but I'm using desktop software less and less these days, so I'm not sure if it's important to me any more.