设为首页 加入收藏

TOP

Android 短信数据库详细总结分析
2014-11-24 08:39:41 来源: 作者: 【 】 浏览:0
Tags:Android 短信 数据库 详细 总结 分析

sms表的uri是
public static final Uri CONTENT_URI = Uri.parse("content://sms");
表项含义,我猜的
strColumnName=_id strColumnValue=48 //短消息序号
strColumnName=thread_id strColumnValue=16 //对话的序号(conversation)
strColumnName=address strColumnValue=+8613411884805 //发件人地址,手机号
strColumnName=person strColumnValue=null //发件人,返回一个数字就是联系人列表里的序号,陌生人为null
strColumnName=date strColumnValue=1256539465022 //日期 long型,想得到具体日期自己转换吧!
strColumnName=protocol strColumnValue=0 //协议
strColumnName=read strColumnValue=1 //是否阅读
strColumnName=status strColumnValue=-1 //状态
strColumnName=type strColumnValue=1 //类型 1是接收到的,2是发出的
strColumnName=reply_path_present strColumnValue=0 //
strColumnName=subject strColumnValue=null //主题
strColumnName=body strColumnValue=您好 //短消息内容
strColumnName=service_center strColumnValue=+8613800755500 //短信服务中心号码编号,可以得知该短信是从哪里发过来的


把源码补上。
在frameworks/base/core/java/android/provider/Telephony.java
/** * The thread ID of the message *

Type: INTEGER

*/
public static final String THREAD_ID = "thread_id";
/** * The address of the other party *

Type: TEXT

*/
public static final String ADDRESS = "address";
/** * The person ID of the sender *

Type: INTEGER (long)

*/
public static final String PERSON_ID = "person";
/**
* The date the message was sent
*

Type: INTEGER (long)

*/
public static final String DATE = "date";
/**
* The protocol identifier code
*

Type: INTEGER

*/
public static final String PROTOCOL = "protocol";
/**
* Has the message been read
*

Type: INTEGER (boolean)

*/
public static final String READ = "read";
/**
* The TP-Status value for the message, or -1 if no status has
* been received */
public static final String STATUS = "status"; us 举例:
public static final int STATUS_NONE = -1;
public static final int STATUS_COMPLETE = 0;
public static final int STATUS_PENDING = 64;
public static final int STATUS_FAILED = 128;
/**
* The type of the message
*

Type: INTEGER

*/
public static final String TYPE = "type"; 举例
public static final int MESSAGE_TYPE_ALL = 0;
public static final int MESSAGE_TYPE_INBOX = 1;
public static final int MESSAGE_TYPE_SENT = 2;
public static final int MESSAGE_TYPE_DRAFT = 3;
public static final int MESSAGE_TYPE_OUTBOX = 4;
public static final int MESSAGE_TYPE_FAILED = 5; // for failed outgoing messages

public static final int MESSAGE_TYPE_QUEUED = 6; // for messages to send later
/**
* Whether the TP-Reply-Path bit was set on this message
*

Type: BOOLEAN

*/
public static final String REPLY_PATH_PRESENT = "reply_path_present";
/**
* The subject of the message, if present
*

Type: TEXT

*/
public static final String SUBJECT = "subject";
/**
* The body of the message
*

Type: TEXT

*/
public static final String BODY = "body";
/**
* The service center (SC) through which to send the message, if present
*

Type: TEXT

*/
public static final String SERVICE_CENTER = "service_center";


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇深入剖析Android消息机制 下一篇Android工程导入jar文件步骤

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·【C语言】动态内存管 (2025-12-27 06:23:20)
·C语言中的内存管理 - (2025-12-27 06:23:16)
·C语言指南:C语言内 (2025-12-27 06:23:14)
·Redis on AWS:Elast (2025-12-27 04:19:30)
·在 Spring Boot 项目 (2025-12-27 04:19:27)