skip to main bit
a man slumped on his desk, from 'The Sleep of Reason Produces
      Monsters'

Oblomovka

Currently:

Archive for November 2nd, 2008

2008-11-02

well, that didn’t take long: basic tethering app for the G1

The G1 can now work as a basic Web proxy, which means that a full tethering app isn’t far away. If you half-free a device, you end up just forcing users and developers to go to extraordinary lengths merely to get around your half-assed roadblocks. Users of the iPhone have to jump through similar hoops to get their own connection sharing. The sad thing is, as with breaking DRM , the impediments are really only temporary, because any tortuous set of procedures can, eventually, be replaced with a small programmed script. Nobody uses DeCSS to rip their DVDs these days: they use Handbrake, or a commercial DVD ripping program. Similarly, while you have to install the SDK and muck around with proxy settings in this iteration, by Christmas I can guarantee it’ll be one click tethering for the current Android phones.

actual android hacking

Just to show that “disappointing” in my previous posts isn’t some euphemism for “die, impure heathens!”, I’ve been continuing to hack on my G1. Honestly, even if it is an impure love, I’m loving both the phone itself and the application environment. Its integration with the Eclipse IDE even managed to draw me away from Vim. You see how its corruption burns into my soul?

Anyway, for your delectation for Hello, World style programming, and also because Liz wanted it, here’s an Android application I threw together that displays an arrow that (should) always point north (it’s not very accurate, but what do you expect from a $200 compass?) (Source etc for Android Compass.)

Things I like about the SDK: it’s well-documented, and when it isn’t, you have all the source to read. I can’t overemphasise how much of a relief this is. I haven’t coded in Java in literally decades, but with enough code examples I got into the swing (ha, ancient java funny) of it fairly quickly, and also I suspect picked up bits of the Android house style.

The community is a little big fractured — I sense there was a lot of early excitement when the first SDK came out, but a lot of those developers wandered off leaving too many ghost sites). Still, there is now a lot of Android hacking going on in public, and the IRC channel remains very informative (when I wandered off into implementing something with SurfaceView instead of just plain View and then wondered why my onDraw method didn’t work, they quickly put me to rights: you don’t use onDraw with SurfaceView, and you probably don’t need SurfaceView to begin with.)

The tools to interact with the phone seem very mature to my have-not-worked-with-embedded-systems-for-a-decade eyes. I found logs where I wanted to find them (in the IDE, and by typing adb logcat). I didn’t get the sense that Linux was a stepsister to the Windows and MacOS dev environment (and I hope that they do okay by comparison also). The emulator is a godsend, and well-integrated: when I didn’t have the phone plugged in, my code ran in the emulator. When I did, it ran on my phone. Things worked first time. I had fun, and had something to show off on my phone in an evening.

(Two gotchas that I hit when trying to produce this blog entry. I installed the java6-sun packages to run Eclipse and the SDK tools, but you have to actually select it to run rather than the openjdk on my Intrepid Ubuntu setup. Use sudo update-alternatives --config java to pick between the two. Eclipse actually ran fine under the openjdk, but Android’s ddms program complained a little about a GNOME Accessibility Bridge until I switched.

If you don’t want to use Sun’s Java, commenting out the single line assistive_technologies=org.GNOME.Accessibility.JavaBridge in /etc/java-6-openjdk/accessibility.properties also lets you run ddms.

And when you’re signing your Android package (using these Germanic instructions), it turns out that you should sign the apk file in your bin directory, not the one that Eclipse handily offers to export for you. Thanks to toediggety for that obscure bug. You see? Fun!

                                                                                                                                                                                                                                                                                                           

petit disclaimer:
My employer has enough opinions of its own, without having to have mine too.