问题
Just want to ask where does the default android messaging app stores and read failed to send messages. I thought it can be queried on content://sms/sent
with STATUS_FAILED
as status. Thanks.
回答1:
Telephony.Sms.Outbox
. This class will help you retreive messages which were not sent due to some reason.
use URI as content://sms/failed
for retrieving failed sent messages.
Similarly other types can be retrieved as :
Inbox = "content://sms/inbox"
Failed = "content://sms/failed"
Queued = "content://sms/queued"
Sent = "content://sms/sent"
Draft = "content://sms/draft"
Outbox = "content://sms/outbox"
Undelivered = "content://sms/undelivered"
All = "content://sms/all"
Conversations = "content://sms/conversations".
If you want to retrieve it based on type
, take a look here.
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
来源:https://stackoverflow.com/questions/25627673/failed-sending-messages-storage-android