SMS utility on Android 4.4 KitKat - android

Before KitKat was released I had developed an app which uses pre-defined short codes to perform transactions over SMS. For example, sending
"<PIN> BAL <phone number>"
would get you a reply with your credit balance. The user doesn't see the short codes, but instead picks the required function from a list, inserts his PIN and presses send. The message is formulated and sent by the app. The main point here is that his outgoing SMS (which contains his PIN) is not saved anywhere.
Since KitKat however, as long as my app is not the default SMS app, the outgoing SMS is saved in the default Messaging app. I can't ask users to set my app as default either, because it cant be used for normal messaging.
A solution or a workaround would be a lifesaver.

The main point here is that his outgoing SMS (which contains his PIN) is not saved anywhere. A solution or a workaround would be a lifesaver.
Forget it - there's no clean one. See docs:
Also, the system now allows only the default app to write message
data to the provider, although other apps can read at any time. Apps
that are not the user's default can still send messages — the system
handles writing those messages to the provider on behalf of the app,
so that users can see them in the default app.

Related

Android App To Programmatically Receive Incoming SMS Message and Reply Back With A Response

I am hoping to receive some guidance with the issue described below, I am trying to understand if current version of Android OS will allow me to achieve the following:
Background:
I have developed an app and using a basic Android phone as the control panel to manage a peripheral devices connected to the phone / app by wifi and Bluetooth
I want to be able to periodically send an sms to the app / control panel and as the app will be the only app on the device and always running i want the app to:
Detect the incoming SMS
perform certain diagnostic / queries upon detecting the incoming sms
retrieve specific diagnostic values
reply back to the number that sent the sms with a custom message containing diagnostic information in point 3.
The Control panel itself displays a splash screen and is public facing.
Achieving points 2-3 above are not the issue.
I am needing for points 1 and 4 above , the receiving of the sms and replying back with a response to occur without there being any visual sign on the display itself the the above is occurring.
Its my understanding that the above functionality to programmatically receive and sms and send a reply was achievable in earlier version of android.
I am told that at some point later version were modified to prevent the above from being possible to perform programatically.
Thanks in advance for any advise provided
Sending SMS is big Task.
Only default SMS app can send the SMS in android.
To set the app as default messaging app we need to get the sms send and receive permission and register as messaging app in google play store (if you are planning to release it to play store or already released)
In short you have to build the full-fledged Messaging app to send sms.

Delete or avoid receiving messages to default message app kitkat+

I'm trying to make a message application, which work along side the default messaging application. My application needs to intercept messages sent from a particular sender and not let default message application receive it. All other messages should be received by default message app.
After some searching I found that this is not possible from Kitkat onwards unless my message app is the default one. Therefore I thought of deleting messages from the particular number in default message app's inbox after receiving. But from kitkat onwards it is not possible unless my app made default.
Isn't there any way to do this?
What I want to do
Receive messages from a user specified number only to my
application while my application is not the default message application.

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.

How to send an SMS in Android Kitkat from non-default app without writing to SMS Provider

My Android app uses SMS to silently send out notifications. Prior to Kitkat these notifications were not recorded into the SMS Provider and hence did not appear in the user's conversation lists. This is the app's desired behavior.
With the Kitkat SMS changes (refer SmsManger documentation quoted below) these messages are still being sent but are now automatically being written to the SMS provider and thus appearing in the user's conversation lists. This is undesirable for my app.
Beginning with Android 4.4 (API level 19), if and only if an app is not selected as the default SMS app, the system automatically writes messages sent using this method to the SMS Provider (the default SMS app is always responsible for writing its sent messages to the SMS Provider). For information about how to behave as the default SMS app, see Telephony.
It sounds like I could prevent the automatic writing to the provider by making my app the default and then not writing to the provider. However, this would be a terrible user experience in the context of my app, so I would only consider it as an absolute last resort.
My question is then - is there a way to silently send SMS in Kitkat without my app having to be the default app?
I've read the responses to this question Send SMS message using non default SMS app on Android 4.4 but that is more concerned with ensuring that the messages are being written to the provider. I don't want that.
Short answer is no.
Long answer :
There are actually options but it involves a lot of work. One is to download the source code for aosp and modify the mms.apk to allow it to receive intents from your app to send sms without writing to provider.
Another way is to baksmali your phones default sms application and add smali code that would allow you to do the same as above. This would require technical knowledge of smali and decompiling/recompiling apks.
With that said, there are problems that will arise such as what if the phone user decides to use a third party sms/mms application for their short messaging needs.

Android: Is there an onSMSSend event?

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.

Categories

Resources