Home
Blog
Software
Contact
Mailing List
IPhone Products
SMS To Gmail
Voicemail To Gmail
Calls To Calendar
Other Products
TiffWizard
Sites
SaveMySerials
How Long For Me
DocuTerminal
Blog
Twitter
|
<< Back To All Blogs
Reading IPhone Text Messages using C# and SQLite
Friday, September 18th, 2009
As a much more interesting follow up post to my previous post I thought it would be interesting to share my method of accessing IPhone text messages using C# and SQLite.
This is not a "live" method of accessing the text messages, in that it requires that your IPhone be synced using iTunes to get the latest backup of your IPhone. When the backup is completed it backs up all data from your phone's databases, which are based upon SQLite.
After doing some digging through the SQLite databases I found the text messages table, and without further ado, I would like to present how I am reading the text messages from my IPhone:
// The MD5 names always appear to be the same, but if not, you can easily use my previous post, iterate all the files in the Backup directory, and
// then read the text messages based on searching for the proper SQLite database
string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\Apple Computer\MobileSync\Backup\99d264810a1a5d5c6de1030dcd2dc6674a8817da";
SQLiteConnection conn = new SQLiteConnection("data source=" + path + "\3d0d7e5fb2ce288813306e4d4636395e047a3d28.mddata");
SQLiteCommand comm = new SQLiteCommand("SELECT * FROM message", conn);
conn.Open();
SQLiteDataReader reader = comm.ExecuteReader();
while (reader.Read())
{
DateTime UnixBase = new DateTime(1970, 1, 1, 0, 0, 0, 0);
// The timestamp is based on UNIX Epoch, so this will get you the current date and time
DateTime timeStamp = UnixBase.AddSeconds(Int32.Parse(reader["date"].ToString()));
// The address of the sender
string from = reader["address"].ToString();
// The actual "text" of the message
string text = reader["text"].ToString();
// The ID of the message
string id = reader["ROWID"].ToString();
}
Hopefully that will help some of you nerds out there trying to take your IPhonedness to the next level.
SMSin' Tom Out.
Tags
IPhone
CSharp
SQLite
Howto
Related Blogs
IPhone SMS To Gmail V1.2 Released
IPhone SMS To Gmail V1.1 Released
Backing up your IPhone SMS Messages to Gmail and Google Apps
An Update on IPhoneSMSToGmail
No More IPhone for Me
Comments
Currently no comments.
Add A Comment
Name:
URL:
Email Address: (not public, used to send notifications on further comments)
Comments:

Enter the text above, except for the 1st and last character:
|