Transferring messages to android from a sqlite db on my laptop I am a new android user. I switched from nokia to android today only. Been googling around for various solutions to transfer my sms (text messages only) from my old nokia to my new Android (Galaxy Ace with Android 2.3).

After exploring my laptop, I found the synced(using Nokia PC Suite) sms were stored in AppData as a sqlite file.

Can I transfer all these to my new Android? Any app for this?
Well I solved the problem. Documenting the solution here for future references.

Using any sqlite manager (I used firefox plugin- SQlite Manager), export the database to XML format (generally any db manager has options to export the database in csv, xls &amp; xml formats).

If your sqlite was generated by nokia pc-suite sync, you would get an xml like:

&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!--
- sqlite-manager XML Dump
- version 0.7.1
- http://sqlite-manager.googlecode.com
-
- Generation Time: Sun, 08 Jul 2012 14:12:42 GMT
- SQLite version: 3.7.10
--&gt;

&lt;!-- Database: msg_db.sqlite --&gt;
&lt;sm_xml_export version="2.0"&gt;
  &lt;database name="msg_db.sqlite"&gt;
    &lt;table name="messages"&gt;
      &lt;column name="msg_txt" type="3"&gt;Your message body&lt;/column&gt;
      &lt;column name="msg_address" type="3"&gt;+919203487229&lt;/column&gt;
      &lt;column name="msg_folder" type="1"&gt;1&lt;/column&gt;
      &lt;column name="msg_time" type="1"&gt;1305483332&lt;/column&gt;
      &lt;column name="msg_imei" type="3"&gt;355940045825435&lt;/column&gt;
      &lt;column name="msg_status" type="1"&gt;36&lt;/column&gt;
      &lt;column name="msg_uid" type="3"&gt;{c33eb602-1456-4542-a755-268dc3728638}&lt;/column&gt;
      &lt;column name="msg_address_substr" type="3"&gt;4487229&lt;/column&gt;
      &lt;column name="msg_subject" type="3"/&gt;
      &lt;column name="msg_attachments" type="3"/&gt;
      &lt;column name="msg_type" type="1"&gt;0&lt;/column&gt;
      &lt;column name="msg_binary_path" type="3"/&gt;
      &lt;column name="msg_attachment_tns" type="3"/&gt;
      &lt;column name="msg_sent_frompc" type="1"&gt;0&lt;/column&gt;
    &lt;/table&gt;
    &lt;table name="messages"&gt;
      &lt;column name="msg_txt" type="3"&gt;Hi gopi, how are you? ;)&lt;/column&gt;
      &lt;column name="msg_address" type="3"&gt;+919582821300&lt;/column&gt;
      &lt;column name="msg_folder" type="1"&gt;1&lt;/column&gt;
      &lt;column name="msg_time" type="1"&gt;1305516490&lt;/column&gt;
      &lt;column name="msg_imei" type="3"&gt;355940045825435&lt;/column&gt;
      &lt;column name="msg_status" type="1"&gt;36&lt;/column&gt;
      &lt;column name="msg_uid" type="3"&gt;{15a0d257-2318-4baa-b764-dd14c1aa1fb5}&lt;/column&gt;
      &lt;column name="msg_address_substr" type="3"&gt;2821300&lt;/column&gt;
      &lt;column name="msg_subject" type="3"/&gt;
      &lt;column name="msg_attachments" type="3"/&gt;
      &lt;column name="msg_type" type="1"&gt;0&lt;/column&gt;
      &lt;column name="msg_binary_path" type="3"/&gt;
      &lt;column name="msg_attachment_tns" type="3"/&gt;
      &lt;column name="msg_sent_frompc" type="1"&gt;0&lt;/column&gt;
    &lt;/table&gt;
  &lt;/database&gt;
&lt;/smses&gt;


Then you can use the following php script to do the conversion to the generate the xml format script required by the SMS Backup and Restore App.

&lt;?php

$file=fopen("sms-20120708160401.xml", "w");
$xml=simplexml_load_file("messages.xml");
echo $xml-&gt;getName()."&lt;br/&gt;&lt;br/&gt;";
$begin="&lt;?xml version='1.0' encoding='UTF-8' standalone='yes' ?&gt;\n";
$begin.='&lt;?xml-stylesheet type="text/xsl" href="sms.xsl"?&gt;'."\n";
$begin.='&lt;smses count=""&gt;'."\n";
fwrite($file,$begin);
$start='  &lt;sms protocol="0" ';
$finish='/&gt;';
$i=1;
$j=0;

foreach($xml-&gt;children()-&gt;children() as $table) {
    echo $i++."  ";
    $read=1;
    $msg_status=$table-&gt;column[5];
    $msg_folder=$table-&gt;column[2];
    if($msg_status=="34") {
        $type=1;
        $read=0;
    }
    else if($msg_status=="36") {
        if($msg_folder=="4294967295") {
            $type=3;
        }
        else {
            $type=1;
        }
    }
    else if($msg_status=="1" || $msg_status=="5") {
        if($msg_folder=="4294967295") {
            $type=3;
        }
        else {
            $type=2;
        }
    }
    else {
        echo "&lt;br/&gt;".$msg_status."; ".$msg_folder."&lt;br/&gt;&lt;br/&gt;";
    }
    $body=htmlspecialchars($table-&gt;column[0]);
    $body=str_replace("\n", '&amp;#10;', $body);
    $address=$table-&gt;column[1];
    if(strlen($address)==11) {
        $address="+91".substr($address,1);
    }
    else if(strlen($address)==10) {
        $address="+91".$address;
    }
    else if($address=="") {
        $i--;
        continue;
    }

    $sms=$start;
    $sms.='address="'.$address.'" ';
    $sms.='date="'.$table-&gt;column[3].'000" ';
    $sms.='type="'.$type.'" ';
    $sms.='subject="null" ';
    $sms.='body="'.$body.'" ';
    $sms.='toa="null" ';
    $sms.='sc_toa="null" ';
    $sms.='service_center="null" ';
    $sms.='read="'.$read.'" ';
    $sms.='status="-1" ';
    $sms.='locked="0" ';
    $sms.='date_sent="null" ';
    $sms.=$finish."\n";

    fwrite($file, $sms);
}

$end='&lt;/smses&gt;';
fwrite($file, $end);
fclose($file);

?&gt;


One point to be noted:

You have to manually write the count attribute in the smses tag. Just check the number of lines in your generated xml file &amp; subtract 4 from it OR just write the last echoed integer by the script

Now just send this to your android &amp; restore using the SMS Backup &amp; Restore App. Bingo! you are done!