Sending and receiving SMSes without a native messaging application
I tried to research around to find the answer to this question, and I have found bits and pieces to different parts of my question, but I still can't decipher whether it's possible (or at least within the confines of our very small, beginner operation). I'll explain what him and I are hoping to acheive, and just a fairly simply response or maybe some links to some literature on the possibilities would be much appreciated.
I'm not looking for someone to have to spill some code or something like that, as I realize my request will be somewhat vague (as I don't want to give away too much of what our application is about, which we will simply call Alpha) but also be开发者_高级运维cause my knowledge into the world of program is very minimal (I'm more behind the design and everything else than the programming).
We would like to be able to send and receive SMS text messages within the application we are creating, without having to deal with the native messaging application. We would like to do this because (at least with HTC phones), there is no option to easily "copy" a received, individual text message. On an HTC phone, when you long-press an individual text message, the ability to copy the message is simply not there (but it is on Samsung, and I'm not sure about Motorola, so I assume it's a Sense UI limitation).
Because we need an easy way to move the received text message into our application, and since the easy, intuitive way is not available (again, at least not to HTC owners), we have had to try to come up with other ways of doing so. So, we were wondering if it's possible to create your own small text messaging area within our application so that only the text messages that pertain to our application will show up within the application without first popping up in the native messaging application?
Or, is it possible to add a function to the "Message Options" that pop up after long-pressing an individual text, allowing the user to "Send to Alpha application"?
Again, I know this might be kind of vague, or not the easiest to follow, and I wish I had more programming knowledge to put it into more specific terms.
I'm new to the Android development world, as is a buddy of mine who I'm creating an Android application with.
Yes, it is completely possible - for receiving just implement a Listener and add it to your manifest.xml file like so:
<receiver android:name=".MyListener">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED"/>
</intent-filter>
</receiver>
That tells the Android framework that you want to be able to receive and handle all SMS messages.
Here's an article I found that talks about how: http://www.devx.com/wireless/Article/39495/1954
As of Android 1.6, incoming SMS message broadcasts (android.provider.Telephony.SMS_RECEIVED) are delivered as an "ordered broadcast" — meaning that you can tell the system which components should receive the broadcast first.
If you define an android:priority attribute on your SMS-listening , you will then receive the notification before the native SMS application.
Here you can check it as per your requirement and then you can cancel the broadcast, preventing it from being propagated to other apps.
精彩评论