21 January 2010

Droid part 3: h4x0ring k9mail

I wanted to add an "Archive" button and a "Flag as Spam" button to k9mail. I'm not the first person to ask for this feature. Now, if you don't mind patching your copy, you can have it, too. (The patch is attached to comment #17 under the link above.)

Developing on Android is remarkably easy. After I installed the SDK, I created an emulator virtual device with ./android create avd -n fake_droid -t 5 and launched it with ./emulator -avd fake_droid. Building k9mail is also easy: after you check out the source from Google Code, create a file at the root of the working copy called local.properties and add the property sdk-location=/path/to/android/sdk. Now you can build it with ant debug.

You can install the new package with ./adb -d install -r ~/path/to/k9mail-read-only/bin/K9-debug.apk. Change the -e to an -d to install on the device instead of the emulator. Watch for problems with ./adb -d/-e
logcat. The -r performs a reinstallation, so you won't lose your settings from run to run. (That gets old fast.) You might want to set up your own IMAP server for testing; if you do, I recommend dovecot.

There are a couple of gotchas. I found that if I messed around with any of the xml files in such a way that R.java (a generated file indexing certain constants) was modified, I had to run ant clean before ant debug to make sure that the old mapping wasn't used (if I didn't, I got buttons that said one thing and did another). I couldn't figure out how to transfer my settings from the canonical version to my hacked version, so I lost them.

No comments:

Post a Comment

About Me

blog at barillari dot org Older posts at http://barillari.org/blog