How to store sms information? - android

i developed one sms related application by using the fallowing code.
http://mobiforge.com/developing/story/sms-messaging-android
sending and receiving sms is working fine.
but i want to maintain all receiving sms in a list.
if any one know this please help me.
Thanks in advance

you can use
String day = android.text.format.DateFormat.format("dd.MM.yyyy",
new java.util.Date()).toString();
and check this question
Date format conversion Android

#kiran i am not getting exactly your question if you want to show sent SMS or what?if you want to show sent sms then i dont think there is any need to create your layout and show there as there is inbuilt api..please elaborate your question with your problems.

Better you store all the values in the database.
Create columns like receivedmsgs, sentmsgs, receivedtime, senttime,yourmobile,tomobile.
So when you send sms store all the values in the database, and using the yournummber you can get the sent and received messages so on....

Store the UNIX Epoch timestamp of the message. It fits in a long variable and very easy to convert between various date formats and even easier to run complex queries.
Eg.
SELECT * from smsTable WHERE timeStamp > %System.currentTimeMillis()% - 24L*60*60*1000
Gives you all entries for the previous 24 hours.
I'll also add, that's what the native application does.

Related

Transfer big string to another device

In my app I want to send data in string to another device.
What i have now: sending data via QR-code with help of installed messengers (user can pick any like skype).
But it has a limit - nearly 4000 chars.
To clarify: I want to make a system, that can send some info on any distance in some way and receive and parse it next.
Any ideas?
I think you should create a .txt file with that text and you can share it with any messenger.
I think setting up the server is the best solution according to me. Moreover, you can use Firebase database or firebase storage to store your images or stirng. This will allow you to fetch any type to data from anywhere in the world

android studio: handle the messages in the instant messaging app

All the message which is sent by the users should store in database??? if so, how can i store huge amount of message in the db?? insert all message as string to database??
Make a separate record for each message. It gives you better searching and further easy improvement in operation in future.
Thanks

Android: Get all sent sms? (outbox)

I'm writing an app to backup all text messages. Been working on it for a while and i just realized the method i'm using to retrieve sms' only gets the ones i got (the inbox).
Is it possible, in any way, to get the outbox?
If it's not in the Android API, is it possible to get it from the default SMS app somehow? Even if not everybody uses it it will work for now, it's kind of urgent.
to get the sent messages you need to read sent-directory
Use this Uri query
Uri.parse("content://sms/sent");

How to create message and save it in Android?

i am trying to develop a simple application. i want to create a simple message and want to save it. now, i want to select message from list of messages which i have created and stored.
can any one please suggest me or give an idea for developing the same.
Thanks in Advance
If you substitute the word "message" for "note", you are describing something really similar to the notepad example.
It runs you step by step trough the code you need to make an application that has notes (messages) you can add, and open.
If you are new to Android development you should go trough all the excersises, because it's a really good help, but if you're not you can just download the sollution and use that.
I feel you should go like this:
Have your application store Contacts in a database (I guess you're already doing this)
Have your application store messages in another database (I guess you're already doing this too)
In the UI, display all the messages inside a ListView, by querying them from your message database.
When user clicks on any message, have another screen that loads this message in full, and lets the user select the recipients
Send the text message to the selected recipients now
I just wanted to point out the flow of the app, since the storage and retrieval process os pretty straight forward. I am not sure if this was what you were looking for.
Do let me know.
If you will store little amount of data you can use sharedpreferences
http://developer.android.com/reference/android/content/SharedPreferences.html
If you want a real solution that is sqlite database that comes with android.
http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html

Android SMS programming

I want to find a way specific SMS that contains a specific word and answer back automatically.
I have found a way to answer the SMS but I still can't work on finding the SMS...
Its true that its not documented but people have been using this for years and if an update was to change the way we access the SMS database it would affect hundreds of users applications. So I doubt any time soon they would change this.
Anyway, start by creating a cursor object to the SMS database and just run a query with no conditions in the where clause. Then just run through the database pulling out the values you need. Someone was also nice enough to post the different column names in the database. Here they are: How many database columns associated with a SMS in android?
Below is a code snippet to get the SMS's from the database.
Cursor messages;
Columns message = ColumnsFactory.messages(); //points to structutre
messages = getContentResolver().query(Uri.parse("content://sms/"),
null, null, null, null);
while (messages.moveToNext()) {
//do stuff here.
Have you tried Google App Inventor? It has an example of this very type of app.
App inventor example website
In your broadcast receiver for incoming SMS, check the SMS body. If the SMS body contains that particular word then send a reply to that number. In the same way you can also check for incoming numbers.
Example to check for particular number:
if (smsBody.contentEquals("word to match")) {
// create reply
}
There is an undocumented content provider for SMS: "content://sms/inbox" . But this is not official and can change. There is no proper way of sms access.

Categories

Resources