Active Directory Products
Calls To Calendar
SMS To CSV
SMS To Gmail
Voicemail To Gmail
How Long For Me
<< 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);
SQLiteDataReader reader = comm.ExecuteReader();
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.
IPhone SMS To Gmail v5.0 Released
An Update on IPhoneSMSToGmail
Backing up your IPhone SMS Messages to Gmail and Google Apps
IPhone SMS To Gmail v7.0 Released
No More IPhone for Me
Currently no comments.
Add A Comment
Email Address: (not public, used to send notifications on further comments)
Enter the text above, except for the 1st and last character: