Android API之Telephony.Sms

Telephony.Sms

Contains all text based SMS messages. 包含基于SMS消息的所有文本。

1.sms表结构。

_ID

_id

INTEGER(long)

The unique ID for a row.

TYPE

type

INTEGER

消息的类型。有7个可选值。

int MESSAGE_TYPE_ALL    = 0;
int MESSAGE_TYPE_INBOX  = 1;
int MESSAGE_TYPE_SENT   = 2;
int MESSAGE_TYPE_DRAFT  = 3;
int MESSAGE_TYPE_OUTBOX = 4;
int MESSAGE_TYPE_FAILED = 5;
int MESSAGE_TYPE_QUEUED = 6;

THREAD_ID

thread_id

INTEGER

The thread ID of the message

ADDRESS

address

TEXT

The address of the other party

PERSON_ID

person

INTEGER(long)

The person ID of the sender

DATE

date

INTEGER(long)

The date the message was received

DATE_SENT

date_sent

INTEGER(long)

The date the message was sent

READ

read

INTEGER(boolean)

Has the message been read

SEEN

seen

INTEGER

Indicates whether this message has been seen by the user. The "seen" flag will be used to figure out whether we need to throw up a statusbar notification or not.

STATUS

status

INTEGER

The TP-Status value for the message, or -1 if no status has been received.

有4个可选值。

STATUS_NONE = -1;
STATUS_COMPLETE = 0;
STATUS_PENDING = 32;
STATUS_FAILED = 64;

SUBJECT

subject

TEXT

The subject of the message, if present

BODY

body

TEXT

The body of the message

PERSON

person

INTEGER(long)

The id of the sender of the conversation, if present

PROTOCOL

protocol

INTEGER

The protocol identifier code

REPLY_PATH_PRESENT

reply_path_present

INTEGER(boolean)

Whether the TP-Reply-Path bit was set on this message

SERVICE_CENTER

service_center

TEXT

The service center (SC) through which to send the message, if present

LOCKED

locked

INTEGER(boolean)

Has the message been locked?

ERROR_CODE

error_code

INTEGER

Error code associated with sending or receiving this message

META_DATA

meta_data

TEXT

Meta data used externally

2. 在Sms类中定义了CONTENT_URI

public static final Uri CONTENT_URI = Uri.parse("content://sms");

3. 在Sms类中定义了DEFAULT_SORT_ORDER

public static final String DEFAULT_SORT_ORDER = "date DESC";

原文地址:https://www.cnblogs.com/fengzhblog/p/3193973.html