Tips & Tricks on Android

Monday, January 19, 2009

Mount a filesystem read-write

Very often when you want to write files to a particular partition on ADP1, you will get a "Permission Denied" if the partition is mounted read-only.
To get around this, you need to mount the partition read-write. Typically this is done with /system partition

$ adb shell
$ su
$ mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system

(Replace /dev/block/mtdblock3 & /system with appropriate device path and mount point, as obtained from cat /proc/mounts)

Sunday, January 18, 2009

Android Dev Phone 1 Button Combinations

The following are the ADP1 / G1 button combinations for booting in various modes.

Regular mode: Power button

Fastboot mode: Power on with Camera + Power button. Wait until Android on skateboard image appears with text "SERIAL0", and press Back button. It'll enter FASTBOOT mode.

Alternatively, Power + Back button takes you directly to fastboot mode

Recovery mode: Power on with Home + Power button.
In recovery mode,
Alt + L - toggle log text display
Alt + s - apply sdcard:update.zip
Alt + W - wipe data/factory reset

Safe mode: Power + Menu button

The 3-button salute (Call + Menu + Hangup) causes a reboot in any of the above modes.

Using ADP1 without sim card

You know that Android Dev Phone 1 is fully unlocked.  But if you've just opened your box and don't have a sim with a working data plan, you'll be greeted with a "No sim card" "Emergency dial" screen on first boot. Now, if you had a sim card with a working data plan, it'd allow you to go ahead and and sign in with your Google account, but you don't. So you cannot do anything at the "No sim card" screen.

There's a workaround, however. You can use wifi to setup your account. It requires you to use the adb tool available from the android sdk.
  • Connect the device to your computer using the USB cable. You should be able to see a listing for your device if you run adb devices. Then execute the following commands.
  • adb shell
  • $ su
  • $ cd /data/data/com.android.providers.settings/databases
  • $ sqlite3 settings.db
  • INSERT INTO system (name, value) VALUES ('device_provisioned', 1);
  • .exit
  • $ reboot
After reboot:
  • $ adb shell
  • am start -a android.intent.action.MAIN -n com.android.settings/.Settings
Go ahead and setup your wifi and then sign up using your Google account.

Friday, January 16, 2009

IP Address

To find the WiFi IP address on the android dev phone, you can:

1. From the phone
Follow Settings >> Wireless Controls >> Wi-Fi settings and tap on the network you are connected to. It'll pop up a dialog with network status, speed, signal strength, security type and IP address.

2. Using adb (from command-line)
Assuming you have the android SDK installed on your computer, do:
$ adb shell ifconfig tiwlan0

tiwlan0 is the name of the wi-fi network interface on the device.

The command will show the IP address, netmask and other interface parameters like up/down state, broadcast or not, and so on.

My Dream Phone

I received my brand new, unlocked Android Dev Phone 1 yesterday.
I had registered as a developer and ordered the phone for $399 + taxes + $25 registration fee.

Hardware Features

  • Touch screen
  • Trackball
  • 3.2 Megapixel camera with auto focus
  • Wi-Fi
  • Bluetooth v2.0
    • Handsfree profile v1.5
    • Headset profile v1.0
  • 3G WCDMA (1700/2100 MHz)
  • Quad-band GSM (850/900/1800/1900 MHz)
  • GPS-enabled
  • QWERTY slider keyboard
  • Includes 1GB MicroSD card (Can be replaced with up to 16GB card)
  • Included in the box
    • HTC Android Dev Phone 1
    • USB Cable
    • AC Adapter (with US plug)
    • Stereo Hands-Free Headset
    • Battery
    • Getting Starting Guide
    • 1G Micro SD Card (inserted into Device)

So far the experience on this phone has been amazing for me. I'm going to use this blog to record my findings as I learn the exciting new platform.

I've downloaded the android SDK from:
http://code.google.com/android/download.html

This includes many important tools, most notably adb - android debug bridge, which allows me to run all kinds of commands on the device directly from my computer, ie without typing on the device. It also eliminates the need to run telnet or ssh server on the device.