tags:

views:

130

answers:

1

Hi!

I want to be able to control incoming text messages. My application is still on a "proof of concept" version and I'm trying to learn Android programming as I go.

First my application need to catch incomming text messages. And if the message is from a known number then deal with it. If not, then send the message as nothing has happened to the default text message application.

I have no doubt it can be done, but I still have some concern and I see some pitfalls at how things are done on Android.

So getting the incomming text message could be fairly easy - except when there are other messaging applications installed and maybe the user wants to have normal text messages to pop up on one of them - and it will, after my application has had a look at it first.

How to be sure my application get first pick of incomming text messages?

And after that I need to send most text messages through to any other text message application the user has chosen so the user can actually read the message my application didn't need.

Since Android uses intents that are relative at best, I don't see how I can enforce my application to get a peek at all incomming text messages, and then stop it or send it through to the default text messaging application...

A: 

Retriving all incoming messages is just setting up listener, you can do it easily see here

and after that, its fine if you are at do nothing phase, but in case you want to prevent sms to go into the native messaging app it is not advisable to prevent user.

better you wait for some time and then delete the same from SMS database.

Rajnikant
Thanx. But what I'm trying to do is from my application to send a text message to a service - let's say a bank service. And to intercept any messages comming from the same number.So when the user clicks a button in my application to get the balance, it sends a message to a number and my application intercepts the return message.So it is very important that my application get first pick of the incomming messages and that it can pass through any messages that doesn't come from a known number.My concern here is that intents are not an absolute and so can make this impossible.
Espen