sqlite command in adb

February 26, 2009 at 9:34 am | Posted in android | 3 Comments
Tags: ,

Connect to a database:

adb shell

# sqlite3 data/data/com.google.android.providers.contacts/databases/contacts.db

sqlite3 data/data/com.google.android.providers.contacts/databases/contacts.db

SQLite version 3.5.0

Enter “.help” for instructions

List tables:

.table

Print some of the information from the tables:

.header on

.mode column

sqlite> .header on

.header on

sqlite> .mode column

.mode column

sqlite> select * from phones;

select * from phones;

_id         person      type        number        number_key    label

———-  ———-  ———-  ————  ————  ———-

1           1           1           +15085551212  21215558051+

2           1           0           +17815551212  21215551871+

3           1           2           +16175551212  21215557161+

.help can tell you more useful command.

LIKE Operator Example
SELECT * FROM Persons WHERE City LIKE ‘s%’;

ADB on windows and Ubuntu Linux

February 16, 2009 at 6:59 am | Posted in android | 5 Comments
Tags: ,

On windows:

If you’re developing on Windwos (32-bit only), you need to install the USB driver for adb:

1.  Download the driver ZIP file and unzip it.

2. Connect your Android device via USB. When the Found New Hardware Wizard appears, you’ll be asked if you’d like Windows Update to search for software, select No, not this time and click Next.

3. Select Install from a list or specified location and clieck Next.

4. Select Search for the best driver in these locations. Browse and select the unzipped file.

5. Click Finish. You’re all set.

On Ubuntu Linux

1.
Plug-in your device then exec command ‘lsusb’ then you will see the list of current usb devices

Bus 003 Device 023: ID 18d1:d00d

We will see a device is appeared when it plug-in and disappeared when it plug-out. That device is we wanted and take my environment as an example it is located at line 1, “Bus 003 Device 023: ID 18d1:d00d”, without device provider.

2. Login as root and create this file: /etc/udev/rules.d/50-android.rules

For Gusty/Hardy, edit the file to read:

SUBSYSTEM==”usb”, SYSFS(idVendor)==”18d1“, MODE=”0666″

For Dapper, edit the file to read:

SUBSYSTEM==”usb_device”, SYSFS(idVendor)==”18d1“, MODE=”0666”

P.S. the “18d1” is hard coded in android/kernel/drivers/usb/gadget/android_adb.c 
#define DRIVER_VENDOR_ID

2. Nwx execute:

chmod a+rx /etc/udev/rules.d/50-android.rules

3. Restart udev to make the rule active.

 sudo /etc/init.d/udev restart

Blog at WordPress.com.
Entries and comments feeds.