How to manipulate certain incoming SMS messages in Android?
I want to change sender number before message will reach Inbox (so all text messages coming from a range of numbers wold be grouped into single conversation).
Can this be done from broadcast receiver of android.provider.Telephony.SMS_RECEIVED intents?
I dont think you can do it. What you get through android.provider.Telephony.SMS_RECEIVED, the data is a copy, so even if you change it wont be changed for other Recievers. You can block it from going to other Broadcasts, but not change it and rebroadcast
What you could do is manipulate using contentProvider of SMS . You will need WRITE_SMS permission
You cannot modify incoming messages in "stealth mode" and you cannot replace broadcast with your fake message without rooting and platform modifications. You can try to play with SMS using content provider but you need WRITE_SMS permission so your intentions would be clear to many.
Related
i want to goes through some condition statement when a user hit a "send sms" button and thus if condition is satisfied then send the sms otherwise abort the composed sms !
can any one help me ?
No there is not broad cast activity to use it when sms is going to send,
This is not possible. Any application can use SmsManager to send an SMS, and such messages cannot be intercepted, except perhaps by custom firmware.
You can't block an outgoing sms. You can find out about it only after it has been sent. And you can do it by registering a content observer for sms, when the sms comes to sent box.
It is good question, when you are working by using any builten application in android, then it gives you some facility upto some extent, but you can't cross the limit.
If You want to control the send button of builten apps then it is impossible. You can't do this in android.
I am new in Android development and I'm doing an SMS app that receives multiple SMSes i.e notification SMS that's captured into the ListView and another SMS that contains the location of the sender for use in displaying the sender's location on google map.I've managed the first part,how do I listen again for the second SMS using the BroadcastReceiver...In other words how to listen for an incoming SMS when multiple different SMSes are expected.
If you impleted correctly the BroadCastReceiver you shouldnt worry about the second time, it would be fired automatically. You should post your code to have more information.
Welcome to Android development!
In order to receive incoming SMS's, you need to use the BroadcastReceiver mechanism that listens to incoming SMS's intent.
But, If you want to be sure that the message is going throw your app before it gets into the System's database, you have to give your BroadcastReceiver's Class a high priority on the manifest.
Good Luck.
I write application which will get data from received SMS. This is data only for application and I dont want to user can read this message. Is possible to consume SMS just after get data from them to prevent user from reading this SMS? Thanks for any help.
You will need a sms receiver see http://davanum.wordpress.com/2007/12/15/android-listen-for-incoming-sms-messages/
Maybe you need also to delete the received sms.
Yes, this is easy to do. See my answer here for how to do this:
SMS receive with no notification
Once you've confirmed that the SMS is one of your special ones, you just need to call abortBroadcast() to stop it going into the user's inbox:
// Stop it being passed to the main Messaging inbox
abortBroadcast();
You should also be aware that the SMS receiver will not intercept SMS messages sent to the user's Google Voice number, as by default those messages will be downloaded over the data connection and displayed by the Google Voice app. If their Google Voice number is configured to forward the SMSs to the phone then those will be handled fine by the SMS receiver.
I am developing the app which holds the messages in it's own inbox rather than the native inbox.
This can be achieved only if the incoming messages are prevented from reaching the native inbox.
There is some attribute android:priority in <intent-filter>, by which message can be first received by current receiver than others.
But I do not know how to do it properly, does anyone know?
I assume you mean SMS messages? The best, and only AFAIK, is to receive the message via registering the proper BroadcastReceiver object, copying the message into your database, marking it is read in the SMS ContentProvider and then deleting it from the SMS ContentProvider. Check out this article on how to receive SMS messages and then check out this SO post on how to use the SMS content provider.
Edit I actually stand corrected, there is another method that I've had sometimes limited success with. In the BroadcastReceiver you can call the abortBroadcast() method to cancel the broadcast. The important thing here is that you register your receiver with an intent filter that has a higher priority (say, 100) so that it receives the SMS before anybody else does.
I am trying to implement an app that will only listen for a certain header in the SMS.
(Parse the sms message and look for some header)
That's not hard to do.
The problem is once the app finds the header and knows this SMS is for me,
I don't want other app(that has broadcast listener on SMS) to receive SMS.
(for example, 'messages' to pop-up with sms message)
Is there a way to listen SMS before any other apps and decide to pass on to other app
or don't pass to other apps?
See one of the answers for the following question Can we delete an SMS in Android before it reaches the inbox?. It explains how to receive the BROADCAST, set the priority of your app so you receive the broadcast first so you could do your checks then cancel the broadcast so no other app receives it.
Read about BroadcastReceiver. You should use ordered broadcast - use android:priority attribute, and then call abortBroadcast() in your BroadcastReceiver.