2

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.

Jj Tuibeo
  • 773
  • 4
  • 18

1 Answers1

4

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
Sagar D
  • 2,588
  • 1
  • 18
  • 31
  • Hope that helped you achieve what you wanted :) – Sagar D Sep 02 '14 at 16:28
  • Thanks sir. :) found out that I don't need to have other query for failed messages, I'm currently querying all messages for a certain thread_id, and failed messages are included. Just need to check its type. – Jj Tuibeo Sep 02 '14 at 16:29
  • 1
    How to get sent message which is in pending state? – Android dev Jan 22 '18 at 07:38
  • link doesn't work, I keep getting HTTP 503. Also, can you explain how to query for these URI's please? Because I keep getting empty results - see my question here: https://stackoverflow.com/q/52205463/997940 – Yoav Feuerstein Sep 06 '18 at 13:43