I am sending text message through my app. Can we divert SMS to another number in android programmatically?
I am not sure if i understand the question correctly.
You want to forward received SMS to another number?
If thats the case use a broadcastreceiver to listen for the intent android.provider.Telephony.SMS_RECEIVED.
Read the sms and send it to the other number
If your app is the one sending the text message, you certainly have control over which number to send it to.
The question is rather vague but you can easily set a number for your debug build to default to instead of using the number provided.
Related
I want to change text messages when they are in sending status.
In fact, I need to change text of message written by user before sending and add some advertisement in it (maybe add a link). How can I do so?
Is device needed to be root?
No. You can't do that. You should not do that. It's very intrusive. If you want to do that, create an Sms Client of your own and do that.
sorry fo my complete ignorance developing an Android.
I'm asking about the feaseability of this pseudocode I would like to implement as native app; let imagine a task that:
when a specific SMS arrive (only those sent from a specific sender number)
possibly (multi-SMS in case of text bigger than 160 chars )
elaborate/format each received SMS:
. save text content on a local db
. print text on a bluetooth printer
. reply to sender with some sort of "ACK" SMS
BTW, what above could be sort of background task, and I would need on foreground a sort of user interface that visualizes received SMS and do some user actions (sending back SMS to sender)
Is all that possible on Android ? Any issue ?
I mean, above all: is possible to "catch" specific SMSs (by example those sent by a specific sender number), living unalterated the usual SMS workflow for ALL other SMSs ?
Sorry for my beginner question and Thanks for your patience
giorgio
www.giorgiorobino.com
Following this link to implement a BroadcastReceiver that will listen for incoming SMS.
Inside your onReceive from your BroadcastReceiver, handle your logic (print/save/..)
It is possible, yes. But not recommended. That being said the way to set this up is to catch the SMS intent, so your app would be started when an SMS is received. Otherwise it would not run at all (as long as you don't have any other interface open). For a code example on the message interception part, see this post. For the database part look up local storage on android phones. Look up on SMS messaging for the reply. Not sure how bluetooth printing would work as I've never done it, but if it's a standard protocol I'm sure there's either built in support or a library for it.
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 attempting to develop an Android application that sends and receives SMS messages (among other things)
i wish to have my apps SMS messages easily identifiable.
I didnt want to use the SMS message body for this unique identifier, i thought there must be an SMS message attribute i can use. sadly i have failed to find one or track down a technical spec for SMS messages in general.
does anyone know if the SMS message standards have an ID field that can be se programmatically?
No, there is not.
You can see the contents of an standard SMS message on page two of this document, and on this page.
The way I have handled this is by setting an SMS listener with a higher priority than the system SMS listener that looks for a unique string in all received texts.
If the SMS contains the string I handle it in the application and discard the SMS so that I do not litter the users inbox.
The users message alert tone doesn't even go off. It works quite well.
See this post for more info on how to do this:
Can we delete an SMS in Android before it reaches the inbox?
i know it's been 4 years . but in case anyone passes through this question.
yes SMS has unique id called _id and you can identify SMS through it.
for more info please refere to this answer.
I've got an idea for an Android Application, however I am unsure if it would work. Essentially what I want to do is "intercept" all text messages sent from any SMS App and make modifications to them.
For example, say I write out the following SMS:
Hi {Name}, how are you today? Can you tell {Boss} I'll be 15 minutes late today.
The onSMSSend function in my application(assuming it is currently running in the background) would then be able to edit the content of the message(Eg. Replacing variables with ones defined in the application), and then send it on to the recipient.
Is Android able to provide this functionality?
No it is not. Android may be able to inform you after an SMS was send. But there is no way to intercept a message that should be sent and apply changes to it on a non rooted phone.
What you could do is to write a new messaging App that allows the user to type a message, choose a number and send the message. Now you have full control over the message that is send but building a replacement for the sms app is a fair amount of work.