开发者

Reading only specific SMS messages?

I have a SMS reciver that listens incoming SMS messages and saves text from SMS into File on sdcard. I want to listen all incoming messages, but only specific messages, taht begins with word "Nemas" or "Preostalo" are copied to the text file. How can i do that ??

And second, after i processed specific message, and text is开发者_如何转开发 copied into text file on sdcard , can I automaticly set this sms from unread to read ??


for SMS write to the file store the message content into String object as body. now check whether this will start with "Nemas" or "Preostalo" then write into the txt file.

private static final String NEMAS = "Nemas";
private static final String PREOSTALO = "Preostalo";

private String msg;

check the message as you first get the message and store into the msg object

if(msg.startsWith(NEMAS) || msg.startsWith(PREOSTALO)){

     // write the msg into the txt file

}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜