I am working on an application in which i am sending an sms from a device to itself. Now i want to read it from my application. I know how to read it but i also read from the developer page that only one (default) sms application will be able to read the sms. If that's the case how can my application can read the sms that is sent by my application.
To Receive SMS i am using broadcast receiver which is registered in the manifest.xml.
-THANKS
...read from the developer page that only one (default) sms application will be able to read the sms.
Nope. Your app can still both receive and read incoming SMS in KitKat and above using the standard methods (barring any alterations to the standard behavior by the vendor). The changes to the SMS API are a little confusing, but it mainly boils down to the fact that non-default apps cannot write to the Provider. Any app with the RECEIVE_SMS permission can still get messages as they arrive. Also, this broadcast can no longer be aborted, so any and all Receivers registered to do so will receive it. Furthermore, any app with the READ_SMS permission can still read messages from the Provider. As mentioned, they just can't write to it to save messages or update their status.
As testimonial, my device runs KitKat 4.4.4, and I use it to send messages to itself all the time for testing, all from non-default apps.
Related
I have gone through many documentation but haven't clarified yet on the list of rules a default sms should follow!
Android-Dev-Blogspot says this:
only the app that receives the SMS_DELIVER_ACTION broadcast (the
user-specified default SMS app) is able to write to the SMS Provider
If our app is default sms App should we manually write all the incoming and sent sms to the db or does the system handles that.
Its not properly explained anywhere or maybe I am missing it. I need to know all the rules of being a default sms app. Any help would be appreciated!
The default messaging app is responsible for writing all incoming SMS messages, and its own outgoing messages. SMS messages sent by non-default apps will be written to the Provider automatically by the system.
The official word on this is spread across two documents. The 4.4 API release notes state:
Once selected, only the default SMS app is able to write to the SMS Provider and only the default SMS app receives the SMS_DELIVER_ACTION broadcast when the user receives an SMS... The default SMS app is responsible for writing details to the SMS Provider when it receives or sends a new message.
That blog page, which the release notes also link to, covers the non-default situation:
If and only if an app is not selected as the default SMS app on Android 4.4, the system automatically writes the sent SMS messages to the SMS Provider (the default SMS app is always responsible for writing its sent messages to the SMS Provider).
It's been a while that I'm surfing the net in order for finding a way to disable the broadcast for incoming sms-text, but mainly it's said that on android 4.4+ you can't do this because it's feature has been removed. But I can show you this is Wrong. In a banking application (targeted android 4.9) in this link
you can find an application which sends out and receives sms without having other apps noticed the transmition of sms. you can download the app here.
Please help me with this issue. how can I Receive sms without having other apps notified ?
They're most likely using data SMS, also known as port-addressed SMS. In fact, a quick, crude unzipping of the APK, and a short perusal of the manifest shows that they have a Receiver registered for the DATA_SMS_RECEIVED action on port 7442.
Data SMS are not handled by the Provider (apart from collation), and only apps listening on that specific port will receive them, so they won't appear in the platform app, or pretty much any other SMS app.
So it's not a matter of the SMS_RECEIVED broadcast being aborted, or the SMS_DELIVER broadcast being intercepted. It's just not regular text messaging.
I'm developing an application that works like an SMS BlackList / WhiteList. It is not a SMS application right now.
The goal is:
If the number is in Blacklist, it prevents the user for receiving / sending sms and it does not appear on his sms applications.
If the number is in Whitelist, the user can do everything he wants.
With some special cases, messages that have been blocked are stored in our database to be send after few hours;
To sum up my app needs to be able to:
Block SMS (before any other app can deal with it, like a popup sms app)
Send SMS
So far, the component works fine with android pre KitKat.
The idea is to deal with broadcast (for received sms) and observers (for sms to send).
By the way, the KitKat SMS handling is mainly different. As I know, we kind of need to be the default sms app to send message.
My questions are:
Do I really need to be the default SMS app to send / observe messages ?
Do I have to implement a kind of basic SMS app or is there another way to send SMS with SMSManager for example ? (http://android-developers.blogspot.fr/2013/10/getting-your-sms-apps-ready-for-kitkat.html)
Do I really need to be the default SMS app to send / observe messages ?
Do I have to implement a kind of basic SMS app or is there another way to send SMS with SMSManager for example ?
No. Any app with the SEND_SMS permission can still send messages using the SmsManager's standard methods, and the writes to the Provider will be taken care of for you, if and only if your app is not the default SMS app. If yours is the default, it is responsible for the writes.
Any app with the RECEIVE_SMS permission can still get the SMS_RECEIVED broadcast and read the message from the Intent. Also, the SMS_RECEIVED broadcast cannot be aborted, starting with KitKat, so there's no real way to block any app listening for that broadcast from receiving incoming texts, even if your app is the default. However, apps that are compliant with the recommended behavior of SMS apps in KitKat or above will disable any processing of incoming messages if they're not the default. That is, if your app is default, other apps shouldn't care about incoming messages.
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.
I have an app that has device admin rights. My app monitors received SMS's and passes the content through some logic. Can i change the default SMS app to my app programatically . My app checks for spam messages so it needs to read/write/update SMS db. I want a fix for kitkat.
I just noticed that the incoming SMS notification on my app are no longer notifications for new SMS that are received , but instead are "new Hangout message" notifications that are caused by hangouts receiving the incoming SMS. So my app is also not able to receive incoming text messages with SMS_RECEIVED.
Google's Android Developers Blog post about the new SMS API in Kitkat, said that nothing would change for apps using just SMS_RECEIVED and don't try to write the SMS to the SMS Provider.
1 I always believed that the SMS_RECEIVED broadcast is abortable. But the Android 4.4 APIs site says something different: "…when a new SMS arrives by listening for the SMS_RECEIVED_ACTION broadcast, which is a non-abortable broadcast…"
Can i change the default SMS app to my app programatically
Not directly. You can prompt the user to change the default SMS app.
My app checks for spam messages
Repackage your code as a library and license it to SMS clients.
So the Pebble app is also not able to receive incoming text messages with SMS_RECEIVED
Possibly the Pebble app is simply having other problems and is crashing before it notifies the Pebble. Or, possibly the Pebble app is updated for Android 4.4 and, since it knows it cannot stop the Hangouts notification, simply suppresses its own.
Google's Android Developers Blog post about the new SMS API in Kitkat,said that nothing would change for apps using just SMS_RECEIVED and don't try to write the SMS to the SMS Provider
That is not what this blog post says.
I always believed that the SMS_RECEIVED broadcast is abortable
This undocumented, unsupported broadcast had been an ordered, abortable broadcast through Android 4.3. That is no longer the case with Android 4.4, as you can tell by reading the aforementioned blog post:
Note that—beginning with Android 4.4—any attempt by your app to abort the SMS_RECEIVED_ACTION broadcast will be ignored so all apps interested have the chance to receive it.