Is it possible to receive an email and save it like an sms in android, pretending to be an sms received so a broadcast receiver can intercept it?
There's no malicious intent here.
We have a service where we send alerts to our clients devices(we sell them the devices), but since we have lots of GPRS data available, we would like to use that to send them the alerts whenever something happens related to their assets(cars, boats, etc).
So we send an email to the device via GPRS and our app would intercept it, convert it to an SMS so our app on the device could intercept it(already does that for SMS alerts) and open a map and do some other stuff.
So nothing illegal going on here.
thanks.
Related
My app is allowed to send only one SMS per day using the default SMS sender ( which is already present in every android device ), as a result, I need to disable send SMS button once the SMS is sent.
What I am doing currently is, whenever a user clicks on send SMS button, I navigate him to the device default message sender like this,
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.fromParts("sms", phoneNumber, null));
intent.putExtra("sms_body", message);
baseActivity.startActivity(intent);
I can only navigate the user to default SMS sender and then from there the user can either send SMS or he can cancel sending SMS ( by pressing back button ), now the question is how will I be notified that the SMS is sent? Is there any callback or receiver mechanism which can tell me that the SMS was sent or SMS was canceled by the user?
which is already present in every android device
Not really.
I navigate him to the device default message sender like this,
There is no requirement for an Android device to have an app that responds to ACTION_VIEW for the sms scheme. You will have a better chance with ACTION_SEND, as that is what Google says that you should use.
Even then, there will be devices that lack such an app. For example, not all Android devices are phones.
how will I be notified that the SMS is sent?
You won't. What the user does in response to your ACTION_VIEW (or ACTION_SEND, ACTION_SENDTO, or ACTION_SEND_MULTIPLE) request is up to the user and the user's chosen app.
Is there any callback or receiver mechanism which can tell me that the SMS was sent or SMS was canceled by the user?
Not really. For starters, the user might not choose an SMS client to respond to your Intent. After all, any app can have an activity that responds to your Intent structure. Even if the user chooses an SMS client, there is no guarantee that the app will do anything that allows third parties (like your app) to know about what goes on inside that app.
Many, but not all, SMS clients will update the system supplied Sms content provider with the sent item.
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'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.
I write application which will get data from received SMS. This is data only for application and I dont want to user can read this message. Is possible to consume SMS just after get data from them to prevent user from reading this SMS? Thanks for any help.
You will need a sms receiver see http://davanum.wordpress.com/2007/12/15/android-listen-for-incoming-sms-messages/
Maybe you need also to delete the received sms.
Yes, this is easy to do. See my answer here for how to do this:
SMS receive with no notification
Once you've confirmed that the SMS is one of your special ones, you just need to call abortBroadcast() to stop it going into the user's inbox:
// Stop it being passed to the main Messaging inbox
abortBroadcast();
You should also be aware that the SMS receiver will not intercept SMS messages sent to the user's Google Voice number, as by default those messages will be downloaded over the data connection and displayed by the Google Voice app. If their Google Voice number is configured to forward the SMSs to the phone then those will be handled fine by the SMS receiver.
I'm looking for a sort of trigger in Android, that would let me perform a task whenever a sound is played, so for incoming calls, SMS and e-mail notifications. I did find something like this, but it's only for when the phone is called:
http://developer.android.com/reference/android/telephony/TelephonyManager.html
What I want to achieve with this is sending a bluetooth signal to a bracelet, so it starts vibrating. This would be suited for the hearing impeared or people that work/live in a loud environment who don't carry their phone attached to their bodies.
Calls, SMSes and email are handled by different apps and they have different notifications. Besides calls, you can also get notifications for SMS but not for emails.
SMS broadcast is a private API, meaning that it is not officially supported and can change without notice: Android - SMS Broadcast receiver