Android短信开发相关信息记录

相关的协议:

content://sms/inbox        收件箱

content://sms/sent        已发送

content://sms/draft        草稿

content://sms/outbox        发件箱

content://sms/failed        发送失败

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


sms相关的字段如下:

_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 

删除短信:

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); 



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值