SMS/MMS provider - MmsSmsDatabaseHelper
来源:互联网 发布:后三组六杀号软件 编辑:程序博客网 时间:2024/05/21 02:49
SMS/MMS数据都保存在数据库:
/data/data/com.android.providers.telephony/databases/mmssms.db
数据库处理代码在:
packages/providers/TelephonyProvider/MmsSmsDatabaseHelper.java
@Override public void onCreate(SQLiteDatabase db) { createMmsTables(db); // create mms table createSmsTables(db); // create sms table createCommonTables(db); //create common table, for example, thread createCommonTriggers(db); //create common triggers createMmsTriggers(db); // create mms related triggers createWordsTables(db); // create words related triggers, will be used in search function createIndices(db); //create index typeThreadIdIndex about (type, thread_id) for sms tabble }
Function: CreateWordsTables
1.create words table;
2.create trigger for sms update/delete, mms update/delete;
3.init words table
PS: why don't create trigger for sms insert?
private void createWordsTables(SQLiteDatabase db) { try { db.execSQL("CREATE VIRTUAL TABLE words USING FTS3 (_id INTEGER PRIMARY KEY, index_text TEXT, source_id INTEGER, table_to_use INTEGER);"); // monitor the sms table // NOTE don't handle inserts using a trigger because it has an unwanted // side effect: the value returned for the last row ends up being the // id of one of the trigger insert not the original row insert. // Handle inserts manually in the provider. db.execSQL("CREATE TRIGGER sms_words_update AFTER UPDATE ON sms BEGIN UPDATE words " + " SET index_text = NEW.body WHERE (source_id=NEW._id AND table_to_use=1); " + " END;"); db.execSQL("CREATE TRIGGER sms_words_delete AFTER DELETE ON sms BEGIN DELETE FROM " + " words WHERE source_id = OLD._id AND table_to_use = 1; END;"); // monitor the mms table db.execSQL("CREATE TRIGGER mms_words_update AFTER UPDATE ON part BEGIN UPDATE words " + " SET index_text = NEW.text WHERE (source_id=NEW._id AND table_to_use=2); " + " END;"); db.execSQL("CREATE TRIGGER mms_words_delete AFTER DELETE ON part BEGIN DELETE FROM " + " words WHERE source_id = OLD._id AND table_to_use = 2; END;"); populateWordsTable(db); } catch (Exception ex) { Log.e(TAG, "got exception creating words table: " + ex.toString()); } }
其他定义:
public class MmsProvider extends ContentProvider {
static final String TABLE_PDU = "pdu";static final String TABLE_ADDR = "addr";
static final String TABLE_PART = "part";
static final String TABLE_RATE = "rate";
static final String TABLE_DRM = "drm";
static final String TABLE_WORDS = "words";
...
}
public class MmsSmsProvider extends ContentProvider {
/**
* the name of the table that is used to store the queue of
* messages(both MMS and SMS) to be sent/downloaded.
*/
public static final String TABLE_PENDING_MSG = "pending_msgs";
/**
* the name of the table that is used to store the canonical addresses for both SMS and MMS.
*/
private static final String TABLE_CANONICAL_ADDRESSES = "canonical_addresses";
private static final String TABLE_THREADS = "threads";
...
}
public class SmsProvider extends ContentProvider {
static final String TABLE_SMS = "sms";
private static final String TABLE_RAW = "raw";
private static final String TABLE_SR_PENDING = "sr_pending";
..
}
content://sms/inbox 收件箱
content://sms/sent 已发送
content://sms/draft 草稿
content://sms/outbox 发件箱
content://sms/failed 发送失败
content://sms/queued 待发送列表
http://blog.csdn.net/hailushijie/article/details/8734167
- SMS/MMS provider - MmsSmsDatabaseHelper
- sms mms
- 短信专题(SMS、MMS)
- SMS,EMS,MMS
- IM MMS SMS XMPP
- 发送SMS、MMS
- MMS/SMS 入口
- Android MMS/SMS 入口
- SMS/MMS发送逻辑
- 日本的 iphone4 SMS/MMS
- 详细解析SMS、EMS、MMS
- WAP,SMS,MMS,移动电子邮件
- MMS/SMS 收发流程分析
- SMS <--->MMS自动转换机制
- 发送SMS与MMS过程
- SMS-MMS的草稿箱
- SMS-MMS加载列表显示
- MMS-SMS自动转换机制
- 日志回滚与处理
- 训练方略25 (30天突破版式攻略)营销型设计师系列
- 主题模型在文本挖掘中的发展过程
- const修饰指针的三种情况区别
- struct sockaddr与struct sockaddr_in的区别和联系
- SMS/MMS provider - MmsSmsDatabaseHelper
- 利用正则从一个乱七八糟的字符串中取出我们要的字符串
- C语言在printf函数中打印'%'符号
- 不同网段共享一个打印机的实践
- Juniper show interfaces
- 问题完满解决是个伪命题
- winxp开发的.net应用程序(访问oracle数据库),win2008下不能运行
- Android Music中的一个URI:"content://media/external/fs_id"
- Mysql 按年度、季度、月度、周、日SQL统计查询