Android read sms outbox messages
I am trying to learn how to read 开发者_如何学Pythonthe 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.
There are a lot of tutorials and guides for reading the inbox, but these are all using listeners.
The tutorial in question is not reading the SMS inbox. There is no support in the Android SDK for reading the SMS inbox.
I want to read the outbox so I wont be sending any intents or using any listeners.
There is no support in the Android SDK for reading whatever you think the SMS outbox is.
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
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.
You can read OutBox draft message but for that your app must be the default Sms App if you want to check download 2 sms app and check 2nd app conversation(Which is nit default now) you will not be able to see and then make 2 nd app default you will be able to see everything in second app but not in your first app.
精彩评论