UPDATE: This is very old now. There is a much easier and cleaner way to backup/restore and import SMSs now. Full details are available at http://android.riteshsahu.com/apps/sms-backup-restore
I got my shiny new HTC Hero a month back and since then have been wondering how to get my 900 odd SMSs from my Nokia N95 to HTC Hero. I finally managed to do it via a bit tedious process after many trial and errors. I am posting the full method here to help anyone who wants to do it in future easily :).
Before we start please make sure that your HTC phone is rooted. If you have a HTC Hero I used this guide.
Softwares needed on your PC for this to work:
- HTC Sync
- Nokia PC Suite
- ABC Amber Nokia Converter
- MuF’s Nokia SMS convert utility
- Android SDK
- Android SMS Importer (Attachment in the first post)
Export Nokia SMSs to XML:
- Install all above mentioned softwares on your PC.
- Run Nokia PC Suite. Open the Messages application. Select Inbox from the left pane and then select (all)messages and right click and select Copy.
- Create a new folder on your PC called “Inbox” and paste the messages in there. It should create a .vmg file for each message.
- Open the Inbox folder with ABC Amber Nokia Converter.
- Select all messages, File>Save as> TXT(ANSI). Name it for example “Inbox.txt”.
- Run MuF’s Nokia SMS convert utility, open the Inbox.txt file. You will get file Inbox.txt_export.txt.
- Download the attached Import.xml file here (Use Right Click->Save As).
- Open the import.xml with Notepad++.
- Open the Inbox.txt_export.txt, select all, copy.
- Paste the Inbox.txt_export.txt right after the “Inbox” xml tag. It should look like this:
`<folder name="Inbox"><message date="22/08/2009 22:47:55" sender="+4...`
- Repeat the proces for “Sent Items”. Create another empty folder, copy&paste from Nokia Suite, load with ABC Amber, export as .txt, load with MuF’s utility.
- For the xml file generated you will need to replace sender word with recipient and vice versa. I did it by replace sender with a dummy text and then replacing recipient with sender and then dummy text with sender.
- Paste new file into xml after the “Sent Items” tag.
- [Update: After the updated MuF Converter this isn’t necessary. Double check anyways]
Check the date format of messages in the xml file if it is dd-mm-yyyy. It needs to be converted to mm-dd-yyyy. There is an easy way to do it via Notepad++. Do a search and replace using the following instructions:</p> * Open the replace dialogue (ctrl+H) * Find what: <span style="text-decoration: underline;">date=”([0-9]*)/([0-9]*)/([0-9]*) ([0-9]*):([0-9]*):([0-9]*)”</span> * Replace with: <span style="text-decoration: underline;">date=”\2/\1/\3 \4:\5:\6″</span> * Search Mode: Regular expression * “Replace All”
- Save Import.xml
Copy the SMS database from your rooted HTC Android phone
- Connect the phone using the USB cable. Do not mount it as a USB device. Click on the message in notification area which says “HTC Sync” and make sure HTC Sync is running on your PC.
- Open Command Promt on your pc (Type “cmd” in Run) and change to the android SDK tools directory.
- Run the following commands.
adb shell su cd /data/data/com.android.providers.telephony/databases cat mmssms.db > /sdcard/mmssms.db exit exit
- Now mount your SD card for USB transfer and copy the mmssms.db file on your PC.
Import your SMSs into the Android SMS DB.
- Open Android SMS Importer.
- Make sure the Inbox and Outbox names read “Inbox” and “Sent Items”.
- Select Import.xml in Import file field and click on Read button.
- Please note that you may get errors quoting line numbers and column numbers. This is due to invalid characters in xml like & and <. I replaced all “&” in my files with “and”. It did make all URLs in my texts useless but it preserved the rest of it. For < unfortunately there is no easy way so you have to replace one by one as the program reports them.
- Once the program is able to read them you will be able to see a list of your SMSs in the datagrid.
- Select the Android SMS Db file and click on write. If there are too many messages this will take a while.
- Once that is done if you want you can check the db file with a SQLite browser. However this is not required.
Copy the new file back to Android Phone.
- Copy the new database file back to your SD Card.
- Unmount your android phone for USB transfer.
- Connect it to HTC Sync like before and launch Command prompt and change to Tools directory for Android SDK
- Run the following commands.
adb shell su cd /data/data/com.android.providers.telephony/databases mv mmssms.db mmssms.db.old cat /sdcard/mmssms.db > ./mmssms.db chown radio.radio mmssms.db chmod 660 mmssms.db exit exit
That’s it. I imported over 900 SMSs using this. Please do this at your own risk and I am not responsible for any damage. Also feedback is appreciated :).
P.S: I will post a review/tips&tricks article for HTC Hero soon.