Android 1.5:读取短信
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/900294/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android 1.5: Reading SMS messages
提问by Migol
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?
我正在为 Android 创建一个备份实用程序,我需要阅读收件箱、发件箱和 dratfs 的内容。我如何在 SDK v1.5 上实现这一点?
回答by jargonjustin
There is a content providerfor 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.
有一个用于访问 SMS 消息的内容提供程序,但它没有记录在公共 SDK 中。如果你使用ContentResolver.query()
了Uri
的content://sms
,你应该能够访问这些信息。
You can find more information on this Google Groups threador previous questions on stackoverflow.
您可以在此 Google Groups 线程或stackoverflow 上的先前问题中找到更多信息。
回答by hlovdal
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 命令(不确定这是如何完成的),那么您可以通过以下方式进行备份(去掉注释):
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.005and 27.007for details of the commands.