Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I have recently broken my Android's screen. (Again)

Its a T-Mobile G2

Trying to keep up with my busy technology related life is hard enough without losing my link with everyone.

I have rooted the phone and have the USB Debugging already turned on.

Does anyone know how I would check my recent SMS Messaged from the adb shell so I can keep up with work while i save up to get a new phone or a replacement screen.

Thanks for anyone that has any information regarding this.

EDIT

Response to eldarerathis

C:\android-sdk\platform-tools>adb shell
$ cd /data/data/com.android.providers.telephony/databases
cd /data/data/com.android.providers.telephony/databases
$ sqlite3 mmssms.db
sqlite3 mmssms.db
sqlite3: permission denied
$

cant chmod the file. do you know actually where it is ?

$ chmod +x sqlite3
chmod +x sqlite3
Bad mode
$

su leaves me with only basic commands

$ su
su
# cd /data/data/com.android.providers.telephony/databases
cd /data/data/com.android.providers.telephony/databases
# sqlite3 mmssms.db
sqlite3 mmssms.db
sqlite3: not found
#

Corrected

sqlite was not installed

C:\android-sdk\platform-tools>adb shell
$ cd /data/data/com.android.providers.telephony/databases
cd /data/data/com.android.providers.telephony/databases
$ sqlite3 mmssms.db
sqlite3 mmssms.db
SQLite version 3.6.22
Enter ".help" for instructions
sqlite>

Also to Access the database I needed to be root.

C:\android-sdk\platform-tools>adb shell
$ su
# cd /data/data/com.android.providers.telephony/databases
cd /data/data/com.android.providers.telephony/databases
# sqlite3 mmssms.db
sqlite3 mmssms.db
SQLite version 3.6.22
Enter ".help" for instructions
sqlite>

Thanks a lot eldarerathis

This Link Helped

share|improve this question

migrated from stackoverflow.com Jul 20 '11 at 11:36

This question came from our site for professional and enthusiast programmers.

    
It looks like you don't have the sqlite3 binary on your device. The first link in my answer has instructions to help you install it to /system/bin. Here is a link to the binary itself. –  eldarerathis Jul 18 '11 at 19:47

3 Answers 3

up vote 6 down vote accepted

This is really ugly, but you can read them from the command line by using sqlite3 to view the database entries. You'll probably need to dig up a binary for this unless you have a custom ROM installed. There are some instructions for installing said binary in this Stack Overflow question, and SuperOneClick comes packaged with it (a copy of the binary itself can be found here).

If you do need to install the binary, use mount (with no parameters) to determine where your /system partition is physically located (mine is /dev/block/mtdblock3, for example). Then follow the instructions in the first link above, and start by remounting it in read/write mode with the command:

mount -o rw,remount /your/system/partition /system

Once you have sqlite3 you'll want to open an adb shell, switch to root with su, and then do the following:

# cd /data/data
cd /data/data
# cd com.android.providers.telephony/databases ***
cd com.android.providers.telephony/databases
# sqlite3 mmssms.db
sqlite3 mmssms.db
SQLite version 3.7.2
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> SELECT * FROM sms WHERE read=0;

This will pull up all of the rows from the table for all of the unread messages. The columns in the table are defined thusly (so you can trim the SELECT):

CREATE TABLE sms (_id INTEGER PRIMARY KEY,thread_id INTEGER,address TEXT,
  person INTEGER,date INTEGER,protocol INTEGER,read INTEGER DEFAULT 0,
  status INTEGER DEFAULT -1,type INTEGER,reply_path_present INTEGER,
  subject TEXT,body TEXT,service_center TEXT,locked INTEGER DEFAULT 0,
  error_code INTEGER DEFAULT 0,seen INTEGER DEFAULT 0);

***Note for the marked line: this may be slightly different depending on your device and version of Android which is why I have included this cd command separately. I think it used to be com.android.providers/telephony/databases on older devices but I don't quite remember. Use ls to look around for the proper pathing here.


Alternatively, you could try copying the .db file onto your SD card (or pulling it with adb pull) and then reading it on your computer with sqlite.

share|improve this answer
    
I tried this and it seems that sqlite3 has permission denied –  Jason Jul 18 '11 at 19:38
    
it says bad mode –  Jason Jul 18 '11 at 19:42
    
@Jason: You need to be root to read that directory (just execute su beforehand). –  eldarerathis Jul 18 '11 at 19:42
    
@Jason: Hm, use chmod 0755 sqlite3, then. Maybe the stock chmod binary doesn't like the +x parameter. –  eldarerathis Jul 18 '11 at 19:43
    
as soon as I execute su. it acts like there are no commands –  Jason Jul 18 '11 at 19:44

Thanks to the beautiful hint above from eldarerathis, I just do

DB=/data/data/com.android.providers.telephony/databases/mmssms.db
echo 'select address,body from sms;' | ./sqlite3 -csv $DB 

to read my SMSes from my root prompt.

Since I didn't have sqlite3, I first had to download it with

curl http://dl.dropbox.com/u/16958605/sqlite3
chmod a+x sqlite3

Or see SQLite3 installer on Google Play (if you don't trust the dropbox source).

share|improve this answer
1  
A dl.dropbox.com URL for that binary doesn't feel safe. Can you supply an official source? –  bigbadonk420 Oct 26 '12 at 10:58

Use Experitest's SeeTest to control, and watch your device's screen on the PC screen.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.