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

相關文章
相關標籤/搜索