I'm new to android programming. just to improve my skills, i started with some project in my mind.
when app starts, it will show a button. on click of it, it will allow me to select a contact from the address book. then i want to retrieve all the sms sent to that contact (if they are stored in sms outbox). Is it possible. Can some one guide me. If there is some tutorial on these topics, can you let me know the URL or source code?
Thanks in Advance.
First, it is not possible. There are many SMS clients for Android, many of whom do not expose an "sms outbox".
Second, even if you limit yourself to the SMS application that ships with "Google Experience" phones, the "sms outbox" is not part of the SDK.
If you wish to create an application that sends SMS messages, there is the SmsManager class you can use.
As folks mentioned, the sms outbox is undocument. If you want to access it, you sholud have some skills first.
trace android source code
learn how to use content provider (learn how to create a content provider is better)
what's the authority
know does the URI matched
how to manipulate the Cursor
write some sample code to test
You can find the SMS/MMS content provider here:
https://android.googlesource.com/platform/packages/providers/TelephonyProvider
Related
I have searched google and have not found the answer I was looking for only bits and pieces. I would like to create an application where a user could text a SMS shortcode number with a certain string of text "example: IN" which would then run a command on a server if it matches a specific keyword. Basically it would update a database and then send a message back to the user. My questions are how do I obtain a SMS Short code number? How do I link that with a server? What programming language is the most efficient and effective for accomplishing the task? I have a little bit of programming experience in "HTML, JavaScript, PHP and C" and am willing to learn more languages if required. If someone could answer these questions for me I would be grateful.
Twilio offers this along with their other telephony services. I haven't actually used their SMS service, but I've heard good things about the company in general.
For less than 1/100 of the price of a dedicated shortcode, you can start with a "shared shortcode" provider like TextMarks.
TextMarks owns the "41411" shortcode, and you can lease keywords on it for use with your own applications.
You configure a callback URL, and any incoming SMS messages starting with your keyword get routed to your own web server as HTTP requests. If you respond with anything, your message even goes back to the user as another SMS response.
More info:
TextMarks SMS auto-responder API overview
[Disclosure: I built a large portion of the TextMarks API! Ask me anything.]
You will need a SMS server which is not very common. So you should look for providers like SMSMode or Essendex. But you'll have to pay to receive and send SMS.
I'm in a very big trouble in building a simple custom SMS/MMS content provider wrapper class as long as it doesn't exist an official one for the android platform.
Obviously, to get data, i query on the "content://sms" and "content://mms" content provider using a cursor.
I found it fairly simple with SMS, because the columns names are quite intelligible and contains all data that a typical programmer needs in his application ("person" to get the sms sender/receiver contact id, "address" to get the sender/receiver phone number, "type" to get if the sms is an inbox, outbox, draft, sended sms etc...)
Unfortunately with MMS i've found a lot of trouble. The columns has unintelligible names (ex. "d_tm", "ct_cls", "retr_st", "d_rpt" etc.) and basic informations that i need, such as contact id, phone number, the type of the mms etc... seems to miss.
How can i get this information over the MMS?
I searched over all the 32 columns of the content provider but i didn't found what i need.
Thanks in advance!
P.S.
I know that google advise to avoid this kind of "low-level" operation over content providers that doesn't have a series of official class to access them, but i imagine that software house that operates in sms/mms management such as HandCent or Go Dev team, have built their own content provider using the same approach i'm using too.
Am i right or it exists unofficial libraries to manage SMS/MMS?
Thanks!
I googled a little bit more and finally i found that the correct way to get information like contact_id, phone number, type etc. about MMSs, is to open the content provider to the following
URI: "content://mms/{MmsId}/addr"
({MmsId} is the MMS "_id" column value).
Here i found all information i need.
Hope it helps!!!
I'm looking for any way to send/read a vCard via SMS in my app. I've read a lot of articles, web-pages, forums etc. There is still not even a clue how to do that.
Here is transaction.
User selects some specific contact
App generates a vCard for it
User types a number to send vCard to
App sends SMS with that vCard(?)
Addressee recievs SMS with vCard and asked to browse contact/add to
contacts(?)
Here is some posts in stackoverflow with the same issue: this and this. Still nothing helpful...
I've found this nice library to work .vcf files(both write and read). But is there any way to send it to another phone (and read properly of course)? Just send this as a string maybe?
HERE is a nice stack post about handling data from recieved SMS sent by SMSManager.sendDataMessage() method
Please help! I'll be happy to get any clue, useful library or a proof that it's impossible on Android. If there is no way via SMS can you give me advice how to do that via MMS?
What's interesting, that there is a lot of apps with that functionality, so I guess this is possible.
Thanks anyone who responds. Have a good day.
You don't have to read MMS from code, when you have system for that.
To send MMS with vCard, you need to attach .vcf file to it.
Here is an answer how to do that.
I have a question. I must create a program with a service in backgroud, to control inbox emails and if an email comes from a defined address I do something. Can you help me? I don't find any guide to read emails.
You have to query for it. That's fast and supported on every device: ContactsContract (There's even an example)
Beginner Android dev here.
I'm trying to create an app that will read the SMS messages stored on the device and then give the user statistics about their habits (like who they message often, common words, etc).
But to my knowledge, there doesn't seem to be a way to do this. I've looked around on forums and the most anyone talks about is accessing the inbox where you can find messages the user hasn't read. How then can the default app and third-party (Handcent for example) display the same texts? They don't keep their own database because Handcent will display all texts upon fresh install.
tl;dr: How do I read SMS messages on an Android devices, specifically messages that have been read before.
For a concrete example of accessing the SMS/MMS database, take a look at gTalkSMS.
You are going to need to call the SmsManager class. You are probably going to need to use the STATUS_ON_ICC_READ constant and maybe put what you get there into your apps local db so that you can keep track of what you have already read vs the new stuff for your app to parse through.
BUT bear in mind that you have to declare the use of the class in your manifest, so users will see that you have access to their SMS called out in the permissions dialogue they get when they install. Seeing SMS access is unusual and could put some users off. Good luck.
Here is the link that goes into depth on the Sms Manager
Do the following, download SQLLite Database Browser from here:
Locate your db. file in your phone.
Then, as soon you install the program go to: "Browse Data", you will see all the SMS there!!
You can actually export the data to an excel file or SQL.