NerdyHearn
Home
Blog

Contact
Mailing List

Software

Active Directory Products
Object Compare
Permission Compare

IPhone Products
Calls To Calendar
SMS To CSV
SMS To Gmail
Voicemail To Gmail

Sites
DocuTerminal
How Long For Me
My Music To Me
SaveMySerials
TypeCount

Blog
Twitter

NerdyHearn - Blog


<< 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

An Update on IPhoneSMSToGmail
New Product Release: IPhone SMS To CSV
IPhone SMS To Gmail V1.1 Released
IPhone SMS To Gmail v7.0 Released
IPhone SMS To Gmail V1.2 Released

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:


NerdyHearn - Latest tech news relating to C#, ASP.NET, SharePoint, PHP, general development, and more. DocuTerminal - Online Filing Cabinet solution. Scan, search and archive your paper documents. SaveMySerials - Protect yourself from theft, fire, natural disasters and more by recording your serial numbers My Music To Me - Stream your subsonic music collection to your Sonos wireless system TypeCount - Count how often you type across different computers! ServrTrackr - Monitor your SSL certificates, website uptime, and DNS configurations