Android短信开发相关信息记录

相关的协议:this

content://sms/inbox        收件箱 
spa

content://sms/sent        已发送 
get

content://sms/draft        草稿 
io

content://sms/outbox        发件箱thread

content://sms/failed        发送失败 
date

content://sms/queued        待发送列表service


sms相关的字段以下:rsa

_id               一个自增字段,从1开始 
thread_id    序号,同一发信人的id相同 
address      发件人手机号码 
person        联系人列表里的序号,陌生人为null 
date            发件日期 
protocol      协议,分为: 0 SMS_RPOTO, 1 MMS_PROTO  
read           是否阅读 0未读, 1已读  
status         状态 -1接收,0 complete, 64 pending, 128 failed 
type 
    ALL    = 0; 
    INBOX  = 1; 
    SENT   = 2; 
    DRAFT  = 3; 
    OUTBOX = 4; 
    FAILED = 5; 
    QUEUED = 6;
 
body                     短信内容 
service_center     短信服务中心号码编号 
subject                  短信的主题 
reply_path_present     TP-Reply-Path queue

删除短信:协议

getContentResolver().delete(Uri.parse("content://sms"), "_id=?", new String[]{"3"}); 

getContentResolver().delete(Uri.parse("content://sms/conversations/3"), "_id=?", new String[]{"5"});  

修改短信:

ContentValues cv = new ContentValues();    
cv.put("thread_id", "2");    
cv.put("address", "00000");    
cv.put("person", "11");    
cv.put("date", "11111111");    
this.getContentResolver().update(Uri.parse("content://sms/inbox/4"), cv, null, null);    


插入短信:

ContentValues cv = new ContentValues();    cv.put("_id", "99");    cv.put("thread_id", "0");    cv.put("address", "9999");    cv.put("person", "888");    cv.put("date", "9999"); cv.put("protocol", "0"); cv.put("read", "1"); cv.put("status", "-1"); //cv.put("type", "0"); cv.put("body", "@@@@@@@@@"); this.getContentResolver().insert(Uri.parse("content://sms/failed"), cv); 

相关文章
相关标签/搜索