Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's been a while since I made this question, but here is the answer:</p> <p>First of all as stated before, the fact that the "Draft" hint doesn't appear on the Native SMS app, shouldn't be bothering anyone. Nothing can be done about it, and it's just the way the Native SMS app works. In particular a cache is initialised when the app starts, saving the thread ids of the threads that contain a draft. The draft cache is updated only from the app itself and not from an actual change in the sms table</p> <p>For the saving draft part here is the piece of code to save a draft properly:</p> <pre><code> public static final Uri CONTENT_URI = Uri.parse("content://sms/draft"); public static Uri addDraft(ContentResolver resolver, String address, String body, String subject, Long date, long threadId) { ContentValues values = new ContentValues(6); values.put(ADDRESS, address); if (date != null) { values.put(DATE, date); } values.put(READ, Integer.valueOf(1)); values.put(SUBJECT, subject); values.put(BODY, body); if (threadId != -1L) { values.put(THREAD_ID, threadId); } return resolver.insert(CONTENT_URI , values); } </code></pre> <p>Note: Draft messages may or may not contain the address of the recipient of the message. Drafts are saved on the <em>thread</em> (a thread can contain many recipients)</p> <p>Although the sms database is not documented at all, you can grab the Telephony class from the AOSP and have a look at how to add/remove messages and handle various tasks about sms and mms. <a href="http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.2.2_r1/android/provider/Telephony.java" rel="noreferrer">http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.2.2_r1/android/provider/Telephony.java</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload