I'm creating a backup utility for Android and I need to read content of inbox, outbox and dratfs. How can I accomplish that on SDK v1.5?
Asked
Active
Viewed 2.3k times
2 Answers
17
There is a content provider for accessing SMS messages, but it's not documented in the public SDK. If you use ContentResolver.query()
with a Uri
of content://sms
you should be able to access these messages.
You can find more information on this Google Groups thread or previous questions on stackoverflow.

Community
- 1
- 1

jargonjustin
- 2,199
- 1
- 19
- 8
-11
If you can open a connection to the internal modem and run AT commands (not sure how this is done), then you can backup in the following way (strip the comments):
AT+CSCS="UTF8" // select character set
AT+CMEE=2 // turn on extended error reporting
AT+CPMS="ME","ME" // select message storage in the phone
AT+CMGL=4 // read all messages
AT+CPMS="SM","SM" // select message storage on SIM
AT+CMGL=4 // read all messages
You should of course wait for OK after issuing each of the commands. Refer to 27.005 and 27.007 for details of the commands.

hlovdal
- 26,565
- 10
- 94
- 165
-
Can some of you downvoting this please explain why you think this answer deserves a total of 4 downvotes? To me that indicates something totally wrong and bad advice. This answer is just something that turns out to currently not be possible (but remember that Android might add support for this later and then this answers will be a completely viable option). One downvote might be ok (even though I clearly indicated that the answer was a "maybe the following works..." kind of answer), but I find -4 inappropriate. – hlovdal Jul 12 '11 at 01:15
-
3The contentresolver isn't even an approved method for public development, which has caching and a variety of other improvements over the method you are suggesting. People are downvoting your answer because it is bad practice. You are breaking the abstraction Java and Android are providing. – NikoRoberts Feb 18 '12 at 15:58