I am trying to learn how to read the SMS outbox on Android. There are a lot of tutorials and guides for reading the inbox, but these are all using listeners.
See here:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/os/SmsMessageReceiver.html
The problem with that is it uses public void onReceive(Context context, Intent intent) and uses stuff like intent.getExtras() and uses context as part of the cursor.
I want to read the outbox so I wont be sending any intents or using any listeners. All I’ll be doing is clicking a Read button the main activity, then loading a 2nd activity that displays the body of all messages in the outbox (or with the SENT flag).
Is there a way this can be done, where I can just read all the SMS texts on demand?
Like I said, I’m reading the outbox so can’t rely on an event to trigger this other than a button click.
Thanks for any help.
PS I was able to read a single outbox text using a differnt method (not with SmsMessage) where I used a URI to content://sms/sent and used a cursor to try get through them, but I could only get the first sent message from that, so there must be something up with the looping.
The tutorial in question is not reading the SMS inbox. There is no support in the Android SDK for reading the SMS inbox.
There is no support in the Android SDK for reading whatever you think the SMS outbox is.
This is not part of Android, either the OS or the SDK. This is an undocumented and unsupported capability of the Messenger application that is part of the Android open source project. This application may not be on all devices. It may not be the user’s chosen SMS client. It may be modified at any time in the future by Google. You have been told by Google not to use it.