Organizational Research By

Surprising Reserch Topic

Question:Sms backup in Archive mode


I am creating backup of inbox in "sms.xml" file and I have 100 messages in inbox.

Now I have 105 sms in my inbox, now I want to take backup of only that 5 latest messages in same file. As like in Archive mode.

How can I do it?

 


asked Sep 13, 2013 in ANDROID by rajesh
edited Sep 12, 2013
0 votes
28 views



Related Hot Questions

2 Answers

0 votes
As u know the table structure of sms table, it contains the text msg with the timestamp value.

So u can query the Content provider for values greater than the last timestamp already present in the table.

Steps to be followed,

    Query the latest timestamp that is archived.

    Query the Content provider by suitable changing the selection parameter

By following the example http://www.vogella.com/articles/AndroidSQLite/article.html u can get the usage of selection param in content provider

Siva
Update 1

private static final Uri SMS_INBOX = Uri.parse("content://sms/inbox");
String last_archived_date = xxxxxxxxxxxxx;
Cursor c = getContentResolver().query(SMS_INBOX, null, "date >"+last_archived_date, null, null);

There are many ways to retain monitor last_archived_date i prefer SharedPreference
answered Sep 13, 2013 by rajesh
edited Sep 12, 2013
0 votes
As u know the table structure of sms table, it contains the text msg with the timestamp value.

So u can query the Content provider for values greater than the last timestamp already present in the table.

Steps to be followed,

    Query the latest timestamp that is archived.

    Query the Content provider by suitable changing the selection parameter

By following the example http://www.vogella.com/articles/AndroidSQLite/article.html u can get the usage of selection param in content provider

Siva
Update 1

private static final Uri SMS_INBOX = Uri.parse("content://sms/inbox");
String last_archived_date = xxxxxxxxxxxxx;
Cursor c = getContentResolver().query(SMS_INBOX, null, "date >"+last_archived_date, null, null);

There are many ways to retain monitor last_archived_date i prefer SharedPreference
answered Sep 13, 2013 by rajesh
edited Sep 12, 2013

...