Android 1.5: Reading SMS messages

不打扰是莪最后的温柔 提交于 2019-11-26 08:19:37

问题


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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/900294/android-1-5-reading-sms-messages

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!