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.
Related
I was wondering if it's possible to modify the SMS before sending it in Android, but not only if it's send by my application, but also if it's being send by other applications. My application would work in the background and wait for an sms sending, and when that occurres it prevents it from doing so, modifies it and sends it.
For example, a default SMS application(built-in or otherwise) sends an sms to someone and I want to catch it before it does, modify the body(like add new receiver or some text inside message itself).
I think that this: Can I modify sms_body before sending SMS with built-in SMS Application? might be an answer to my question, but I'm not sure, and it's kind of old.
Let me know if I was unclear in something. Thanks.
Let me try with simple example-
Its just like you have an Account in a Bank and you wish all deposit should come in your Account. Here Account refers to your App and Bank refers to your Mobile device.
In a short, you can't achieve this on a non-rooted device. Yes that is possible on non-rooted device if user like to send his messages from your App, then surely you can modify messages written by user.
not only if it's send by my application, but also if it's being send by other applications
This is not possible, except perhaps on rooted devices.
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.
I would like to know if there is a way to create a service in the application which would prevent user from texting or using specific apps.
Short answer : NO.
You can be able to see what they send and receive, you need a permission for that though, but you can't prevent them from sending a text message.
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.
I want to basically intercept a text message that has an image attached, and save that somewhere automatically. Can this work on Android?
Yes, this should be possible. You can set up a BroadcastReceiver to watch for the android.provider.Telephony.SMS_RECEIVED and parse the message out of that. There's plenty of examples on the web (and questions on StackOverflow).
As for preventing the user from seeing the original message, see also this answer:
Can we delete an SMS in Android before it reaches the inbox?