开发者

Listen for certain incoming SMSes

Is it possible to have an app listen for all incoming SMSes and take some action on certain ones?

I开发者_如何学JAVA read through as many of the similar questions as I could but ended up more confused.

Basically, what I want to do is this:

Every time a new SMS is received, the app checks either the sender or the text, and if a certain string is found shows a message on the screen (Toast, for example).

The app doesn't have a GUI, and if possible I would like to to be running all the time in the background.

If possible, I would also like any SMSes that are shown this way to be deleted before they reach the inbox (or automatically deleted just after).

So, is this at all doable?


Yes this is very possible. With the implementation of a BroadcastListener you could easily be able to determine when an SMS is received by registering the listener to listen to that broadcast. Then in that broadcast receiver code you implement a check for the text of the message. Then do a string compare with what you are looking for and then execute a function.

However; deleting the message from the inbox.. may take a bit of research, i'm not absolutely sure if its possible to delete SMSes programatically, but it wouldn't surprise me if it is included in the API, although, I've never seen it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜