Android的短信保存在短信库里,但并提供类似Contacts的公开的Content Provider方便操作。这里简单的介绍下:android中的短信信息保存在/data/data/com.android.providers.telephony/databases目录下的sqlite库中。常用的表有:canonical_addresses, sms, threads。对短信的操作基本也就是对这些表的CRUD。下面先看下这些表的结构,也可以使用sql查看表中的内容
d:\test>adb shell $ su su # cd /data/data/com.android.providers.telephony/databases cd /data/data/com.android.providers.telephony/databases # ls ls firewall.db mmssms.db-wal telephony.db-shm mmssms.db msmsms.db telephony.db-wal mmssms.db-shm telephony.db traffic.db # sqlite3 mmssms.db sqlite3 mmssms.db SQLite version 3.7.2 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> .tables .tables addr pdu threads android_metadata pending_msgs words attachments rate words_content canonical_addresses raw words_segdir drm sms words_segments part sr_pending sqlite> .schema threads .schema threads CREATE TABLE threads ( _id INTEGER PRIMARY KEY, date INTEGER DEFAULT 0, server_date INTEGER DEFAULT 0, message_count INTEGER DEFAULT 0, unread_count INTEGER DEFAULT 0, photo_id TEXT, recipient_addresses TEXT, recipient_names TEXT, is_sp TEXT, person_id TEXT, recipient_ids TEXT, snippet TEXT,s nippet_cs INTEGER DEFAULT 0, read INTEGER DEFAULT 1, type INTEGER DEFAULT 0, error INTEGER DEFAULT 0, has_attachment INTEGER DEFAULT 0, state INTEGER DEFAULT 0); sqlite> .schema sms .schema sms CREATE TABLE sms ( _id INTEGER PRIMARY KEY, thread_id INTEGER, address TEXT, person INTEGER, date INTEGER, server_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, timed INTEGER DEFAULT 0);Android SMS 短信操作
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:http://www.heiqu.com/12e61f9684ba1b85ea624412a560e181.html