Important
Although the following methods can be used to access messages on the Android platform, the API is probably hidden from developers for a reason.
I think it’s hidden because mobile manufacturers are free to implement messaging as they like and the messaging application provided by Google is there only because every mobile platform needs messaging. I’m just guessing though…
Everything which is not in the official API reference is likely to change between releases and can also disappear without notice. Probably the API will be available with minor changes in “Google Experience” labeled phones because these devices ship the unmodified release builds, however there are already problems with this API on Hero, which is heavily customized by the manufacturer.
So think of this API as a reference implementation of messaging provided by the Google developers, which may or may not be available on an Android based device.
What we know
The official API has SmsManager to send sms.
For some reason android.provider.Telephony is hidden in the SDK although it is still in the /frameworks/base/core/java/ directory which in my reading should be public and usable to app developers. Let’s pretend for now that this is a mistake and it is public. This file has the [public static final String SMS_RECEIVED_ACTION = "android.provider.Telephony.SMS_RECEIVED"] broadcast intent to capture incoming messages. You have to hardcode the string “android.provider.Telephony.SMS_RECEIVED” in the intent-filter but at least it’s defined in the core.
Reading/Writing messages
Here comes the part which is NOT in the core platform. Everything is defined in the /packages/providers/TelephonyProvider/ directory. Accessing messages can be done through the standard ContentProvider API. The usable Uri-s are:
content:// +
sms
- retreive all messages
sms/inbox
sms/sent
sms/draft
sms/outbox
- retreive messages from the respective folders
sms/#
sms/inbox/#
sms/sent/#
sms/draft/#
sms/outbox/#
- retreive a messages identified by its _id (Because _id-s are unique, all of the above maps to a select based on the message _id)
sms/undelivered
sms/failed
sms/failed/#
sms/queued
sms/conversations
sms/conversations/*
sms/raw
sms/attachments
sms/attachments/#
sms/threadID
sms/threadID/*
sms/status/#
sms/sr_pending
sms/icc
sms/icc/#
- List/retreive messages from SIM
sms/sim
sms/sim/#
- Deprecated Uris, “sim” replaced by “icc”
To be continued… I have to find some answers from the platform developers first :)
