Tips and Tricks for Android Users
Tips
Communicating Linux Chroot to Android
Dec 5th
The technique of installing a full Linux distro on your Android phone has been around for a long time. I’ve used it in the past, but for a while didn’t have a phone with a physical keyboard, which made it less useful. Now that I have CM7.1 on my G2 I’ve installed it again. I’m actually using an updated prepackaged version of Ubuntu, which has been fantastic.
However, generally speaking you can run the command line stuff and have it manipulate stuff on the filesystem, but the stuff you run “in Linux” don’t interact with Android. Poking around the other day I noticed that SL4A, the Android scripting system has a “server mode”. Normally the scripts run by SL4A communicate with a generic RPC service which hooks the interpreters back into the Android system. There’s also a mode to just startup the RPC service and bind it to the loopback port or a public interface. And it talks JSON!
So, theoretically, I should be able to startup a SL4A server, run scripts in the Linux environment, and they can send messages to the outside Android system. I needed to test it out of course. If you have SL4A installed you select View from the top level menu, then Interpreters, and then “Start Server” from the menu there, and select “Private” from the context menu that pops up. There should now be a SL4A entry in the dropdown notification area, if you tap on that you can see the running server and it’ll tell you the port. Or, you could just get it from the command line, since thats where we’re going next.
Login via ADB or terminal, or however you prefer. Swap over to Linux, or mount up the unionfs stuff if you’re doing it Saurik’s way. And then you can use anything that can connect to a TCP socket and emit some JSON to send messages. I used netcat for the simplest example:
echo ‘{“id”:1,”method”:”makeToast”,”params”:["The Great HooDoo ..."]}’ | nc 127.0.0.1 38804
And tada! The message shows up on my device:
Really hacky thing to do right now, but it’s interesting in that it would potentially let that stuff running as Linux commands to interact with the rest of the system. Even just being able to deliver local notifications so that you know to check back on something running in terminal to see updates is pretty cool.
ADWLauncher Settings
Nov 28th
I’ve mentioned the preview setting in ADW Launcher previously. Recently I installed the Cyanogenmod 7.1 release on my Nexus S and started using that as my daily phone for a bit. There are a few additional settings in there I’m really liking. I like the dockbar a lot more than the main dock. What I really like to tune for is density of the screen. I wish there was an effective way to swap to the dockbar all the time. Instead what I’ve ended up doing is:
- Enable the dockbar
- Bind swipe up to show the dockbar
- Bind swipe down to app the app drawer
- Disable hiding the dockbar on app launch
And what I end up with is a dockbar I can drag shortcuts into/out of, and I just use the swipe action to open the app drawer. My homescreen ends up looking something like this:

You have to use the swipe up to bring up the dockbar instead of the main dock, but once you do it sticks around.
Using Your Android Phone as a Remote Control
Feb 14th
What I initially set out to do was find a program for my G2 that would allow me to use it as a Bluetooth trackpad and keyboard with the Mac mini I have hooked up to my television. I use it as a media PC, but it’s also a general purpose system. Every now and again it’s convenient to be able to control it using a full keyboard and mouse.
I haven’t yet run across the right tool to get my phone to work as a Bluetooth HID device for my computer. But there are some decent VNC clients that do interesting things. I’ve started using AndroidVNC as my default. I wish I could turn off the screen on the device completely. As is I turn the color depth all the way down. Because I’m sitting in front of the computer I can watch the pointer onscreen, transferring the video data over my G2 just cases it to lag.
The essential part to making it work well is to go into the settings and swap the pointer mode to trackpad. That way you can use the touchscreen on the device as a trackpad instead of having to pan around and touch directly (or use the tiny directional trackpad). You still need a VNC server on your PC, but I’m running one anyway so it’s not much of an issue for me. Still, would be nice to be able to use the Bluetooth HID version for other cases. Surprised at the lack of Bluetooth based Android hackery.
Installing Firefox Mobile on a Samsung Captivate
Aug 27th
Mozilla just released a mobile version of Firefox for Android devices. Unfortunately they haven’t directly published the link to the apk. If you follow the download link from a desktop system it takes you to the desktop installer. From a device it takes you to the apk, but I’m on a Samsung Captivate I haven’t rooted yet, so I can’t install from the browser. Instead I downloaded through the browser, sucked the file out using ADB, and the installed that way:
- ./adb pull /sdcard/download/fennec.apk ~/fennec.apk
- ./adb install ~/fennec.apk
Dear Mozilla, great idea directing folks to the right download automatically, but please take this case into consideration. Lots of folks on AT&T devices who can’t install directly. Or, alternatively, AT&T could stop being idiots. Slim chance of that though.
Samsung Captivate Tethering for OS X
Aug 17th
When I plugged my Samsung Captivate into my OS X machine I was surprised to see a network connection dialog pop up on my laptop and what looked like a tethering app pop up on the device. Given that AT&T tries to kill off tethering in every way possible with the iPhone, I figured it wouldn’t be on with my Captivate either. Or at least not easy to get working. No problem though. I just needed to figure out which set of settings to put in the network connection dialogs in OS X.
In the main network settings screen under System Preferences:
- leave telephone number blank
- use ‘WAP@CINGULARGPRS.COM’ for Account Name
- use ‘CINGULAR1′ for Password
Then click the advanced button and setup:
- Vendor generic
- Model GPRS (GSM/3G)
- APN is ‘wap.cingular’
- CID set to 1
After that starting up a network session with my Captivate attached over USB yielded a pretty quick network connection! Now if only they could fix these GPS issues….
On Device Packet Capture
Aug 5th
When I need to capture network traffic from my device I normally capture traffic at a router to see what’s going on. I had seen some mentions of running tcpdump on device and pulling off the pcap file to a desktop to inspect, but Androshark was what people mentioned the most. And it didn’t seem to be actively developed any more. I ran across Shark for Root and Sharkreader recently however. It’s an app for packet capture and a simple packet capture viewer directly on the device. Works out pretty well. Requires root access, and it seems to be working quite well on my Nexus One with CM6. Screenshots below.
Start/stop capture, writes to the sdcard by default:

View packet dump stream:

View contents of an individual packet:

Pirate Boot Logo
Jul 25th
Every proper hacked device needs to boot up with a pirate theme. Fortunately the boot animation is trivial to replace on a Nexus one. I’m currently running CyanogenMod6, but I believe this will work other places. I replaced the boot animation with just a single image of a skull and crossed swords:
There’s plenty of info out there about replacing the boot logo and what the files do. Here’s how to get it up and running through:
- Download the pirate boot animation zip file to your system
- Remount the system partition read-write: adb shell mount -o rw,remount /dev/block/mtdblock3 /system
- Push the file across to your device: adb push pirate_bootanimation.zip /system/media/bootanimation.zip
That’s it, reboot and enjoy! If you want to poke around and change it, it should be pretty easy. There’s a writeup of what the contents of the bootanimation.zip are, which is very useful. Supposedly, also, the zip needs to be uncompressed to work. But that just means setting compression level to 0 when you run zip. This is the command I use on my OS X machine: zip -0 pirate_bootanimation.zip desc.txt part0/boot_00003.png”. That should make it easy to swap in any other picture to customize.
Voice Input Under 2.1
Jul 21st
I’ve been playing around with voice input under Android 2.1. It’s a feature that’s easy to miss, cause the key that starts voice input only appears on the keyboard if you’re on a general text entry field. So for instance, I started up GMail to give it a try the first time, but there’s no speech input button. I assumed it wasn’t enabled and went hunting around for additional options. Turns out I just needed to move past the address field and go to the subject or body. Makes sense, but wasn’t completely obvious to me.
I could see the feature being useful for text messages for instance. But for me the accuracy is still a bit low. Got errors trying it while enunciating strongly in a quiet room. Some of the problems I’m having saying it’s going to be a useful feature are that it’s really difficult to go back and edit out those mistakes. The entire sentence I just dictated is underlined as previous input once the detection is done. So a backspace to try to replace the last word for instance – that erases the entire input. And if it just got a sentence correct and I want to go on, I need to hit the speech input button again to go ahead and dictate some more.
I’m sure the issues are because this was born out of a “voice search” usage and not a general dictation application. Just something to keep in mind if you’re planning to use it. I’ll have to get a 2.2 rom on the phone and see if there are any additional options in there that address this.
Screenshot on a Rooted Device
Jul 20th
In addition to capturing a screenshot with a computer using the Android SDK there’s also a screenshot application (available on the market, called simple ‘screenshot’, I’m not sure how to find out the package name to create a market link for it. It only works on rooted devices, but all of mine are. One nice feature is the “shake to capture a screenshot” option. So that instead of having to keep hopping into the screenshot app to setup a shot, back to the app, wait, hop back to setup another time delayed shot, back to the app, etc. Just setup screenshot to capture when you shake and go through whatever set of screens you want.

