Can we track the messages sent from other application? I mean, when user send sms by android default sms application (or other sms-managing application), can we track the sms situation and make a notification in our application when sms delivered?
No, this is not possible, unless that other app specifically has an API to support such monitoring.
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).
Question regarding content://sms/inbox:
1) Is it advisable to explicitly store incoming messages to inbox?
2) What if an android device has a native messaging app and my messaging app was installed to it, and then I explicitly store incoming messages to inbox, will the messages duplicate?
3) Does android automatically store new messages to inbox regardless if there is a messaging application?
Thanks.
Regarding SMS, details vary depending on the Android version. Prior to KitKat, the SMS API was undocumented. With KitKat, the concept of a default SMS app
was introduced, and the SMS API became public.
Is it advisable to explicitly store incoming messages to inbox?
Pre-KitKat: Yes. If your app is the main or only SMS installed, and no other app gets the SMS_RECEIVED broadcast.
KitKat and on: If your app is the default SMS app, then it is responsible for writing the incoming messages to the Provider. If it isn't the default, then it's irrelevant, since your app won't have write access to the Provider.
What if an android device has a native messaging app and my messaging app was installed to it, and then I explicitly store incoming messages to inbox, will the messages duplicate?
Pre-KitKat: Yes. Unless your app intercepts and aborts the SMS_RECEIVED broadcast, the native app will write the messages.
KitKat and on: Only one app can be the default at any given time, and only it has write access to the Provider. When an app is not selected as the default, it is expected to adjust its behavior accordingly.
Does android automatically store new messages to inbox regardless if there is a messaging application?
Pre-KitKat: No. Native messaging apps are configured to handle the writes. The system doesn't do it automatically.
KitKat and on: No. As mentioned, the default app is responsible for writing incoming messages to the Provider.
So i want to write a PoC app for an idea that I have. One of the feature that my app would do is send a text message (and perhaps receive delivery notification). Its not going to be an SMS app. Just a service which might run in the background and sends sms on some particular interval, unattended (of course with user consent).
i remember in some of android api release, Google took the decision that you can only send receive sms if you have selected your app to be "default" sms app ? I don't remember exactly.
So the question is, can my app (as a service) send an sms and receive delivery notification while not being an SMS app ?
Whenever I try to Google this question, I find how to send sms example with SMSManager and the code to send the sms but no where i could find this answer.
So the question is, can my app (as a service) send an sms and receive delivery notification while not being an SMS app ?
Yes. Since KitKat, there has been the concept of a default SMS app, which is what I believe you're referring to.
The main difference in the way SMS are handled as of that version is that only the default SMS app has write access to the Provider, but any other app can still send and receive messages as usual. If your app is not the default, any messages it sends will automatically be written to the Provider by the system.
Furthermore, the SMS_RECEIVED broadcast can no longer be aborted, so you don't have to worry about some other app intercepting incoming messages before your app gets a chance to handle them.
I am developing an Android App which receives SMS from a particular number constantly. I want my App to parse the SMS and display to the user accordingly. I wrote a broadcast receiver which intercepts sms and I can read the message sent from a particular number. However I do not want the user to get a push notification when the mobile receives an SMS from the number. Is there any way I can go about it?
From the android developer website, it seems from Android 4.4+ we cannot use abortBroadcast function to avoid broadcasting to the other applications.
Yes there is no way you can block the SMS going to other applications. But We have achieved this by customising the android framework which is proprietary implementation.
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.