Android: Is there an onSMSSend event? - android

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.

Related

Sending Too much messages programmatically in Android jellyBean

I'm trying to send Text messages to different contacts in a bulk. The contacts are several hundred and i'm reading them from a text file. Now when my app tries to send messages , A Dialog Appears telling
App is sending too much messages => Allow , Deny
I've studied several forums that it's a restriction introduced in JellyBean to prevent malicious activity and it can't be undone without rooting your device and running some weird scripts. Is there a fix to this problem? if there isn't any fix , then can we Programatically click Allow button on that message dialog within our app?
Thanks in advance.
Is there a fix to this problem?
Send fewer messages.
Or, send the messages at a slower rate.
Or, use some sort of online SMS gateway to send the messages, perhaps through a serve of yours, rather than sending them through Android's SmsManager. You can find some of these by searching for online sms gateway on your favorite search engine.
can we Programatically click Allow button on that message dialog within our app?
No. The point behind the block is so that the user gets a vote as to whether your app can spend quite so much money (or SMS allotment from a post-paid plan) on the user's behalf. Bulk SMS is not designed to be done from Android, but rather from an online SMS gateway.

Receive specific SMS and elaborate it with an Android app?

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.

capture the Sms exactly before being sent

I’m trying to develop an application to do some manipulation (compression and security matters) on the outgoing Sms regardless of the composer application. The main challenge is that I cannot capture the Sms exactly before being sent. For instance the user compose the message body using Go Sms Pro and when the send button is pressed , right before the sms is actually sent we capture it and do the compression and security matters on .
Any solution or replacement idea appreciated.
Starting with KitKat, the SMS content provider has been opened up (finally): http://developer.android.com/about/versions/android-4.4.html
To make this work with previous versions of android, you could set up a content observer to watch content://sms/, query the appropriate tables in that database, and then do whatever you like to erase the message before it goes out. This is just a thought mind you, but whatever you do will likely involve using this method.
This is not possible, short of via your own custom build of the Android OS. You have no ability to intercept, let alone modify, the calls from an arbitrary app via SmsManager to the OS to send an SMS message.

Is it possible to fake an incoming SMS on Android?

In a certain situation, I'd like my app to be able to "fake" an incoming SMS on the user's device, as a sort of notification. This would save me money when I'd normally use Twilio to send a text to my users but I know they already have my app. Is there any way to do this? I imagine it would have something to do with Intents and Content Providers but I don't really know where to start.
To clarify:
I'm not new to Android and I do respect all of the normal Notification methods. However, my app will have an opt-in for text messages and I'd like to be able to trigger them for free rather than paying for it. This is for SMS-specific uses and not as a substitute for a normal Notification.
Yes (although I really don't support doing this) it is, in theory possible by creating and broadcasting the proper intent. Specifically, they android.provider.Telephony.SMS_RECEIVED intent will be received by anybody who is listening for SMS messages, including the default SMS application. This will in turn cause the notification to be displayed.
All of that said, I've only ever done this in a custom version of Android from within the system process. I'm really not sure if a generic application can do this (in fact, I kinda doubt it). The other caveat is that you will need to formulate your data into PDU's which represent the binary data format of an SMS message. You can look this up, but it's nontrivial.
A far better approach would be to simply have your application display a notification in the tray, the way well behaved applications are supposed to notify the users of events. Take a look at the Notification class.
If you install the apk named ApiDemos-debug.apk that usually comes installed with your choosen platform for the SDK, you will find an example in
<Api Demos> > App > Notification > IncomingMessage
the complete source for this package is usually under
<SDK root>/samples/android-xx/ApiDemos

Receive certain type of message only in android

I would like to know how to set prefix (if that's what it is called) to a SMS application I'm creating to receive certain type of messages. example:
I want my application to receive only SMS that has a ++ (2 plus sign) at the beginning of the message body. and normal messages without the ++ will go to the built in messaging application.
a) Is it possible?
b) If yes, than how and where do I set it?
c) I would like more tutorials on SMS application.
pls guide me through
There are a few examples of receiving SMS on an android app. Here's a simple one.
It's quite easy to recognize only your messages. I don't know if you can delete SMS messages without letting the user see them. Seems like a very big security whole, and I wouldn't be surprised if this was prohibited on a non-rooted phone.
yes you can do that.
Read incoming messages.
Check message body for ++ sign
save it to your application database if it has ++ sign in the beginning and delete the message

Categories

Resources