Matteo Contrini
Sep 3, 2015 · 4 min read

So you need to transfer your text messages from a Windows Phone device to an Android one, right? And you realized there’s no simple solution for doing that?

The steps in this guide will make it a bit simpler for you. Note that there are many ways of doing this, so this is just one of them, the one that worked almost flawlessly in my case.

This guide will be divided in three parts:

  • Messages export from Windows Phone
  • Messages processing/conversion
  • Messages import to Android

Requirements

Before to start, let’s make requirements clear. You don’t need both the devices at the same time. You can do the different parts of the guide in different moments.

You wil need:

  • the Windows Phone device for the 1st step
  • a computer with Python installed for the 2nd step
  • the Android device for the 3rd step

Part 1: exporting messages from Windows Phone

We need to get those messages out of the phone. So, download the “contacts+message backup” app, directly from Microsoft. AFAIK, it’s the only way for exporting messages from the phone to a file. But it’s fine, and it’s official.

Once installed, the app will appear at the bottom of the phone Settings. Tap on it (contacts+message backup). If your phone doesn’t have an SD card, use the “pick folder” button in the bottom app bar to choose a local folder.

Start the backup. When it’s finished, transfer the generated file (the one with the .msg extension, if not sure transfer everything) on your computer (use OneDrive, Dukto, Pushbullet, whatever, if you don’t have a cable). The actual messages file name will include the date of the backup and it will have a .msg extension.

Part 2: converting the file

Now we have a .msg file. What is a .msg file? Basically a text file containing an XML representation of all your text messages.

The fact that the file is in XML format makes it simple to read and convert it.


If you want to take a look at the file content, open it and put it any XML viewer. Even if you know nothing about XML, you’ll distinguish these fields for each message:

  • Body — the message content
  • Sender — the phone number of the sender if the message is a received message
  • Recepient (yes, there’s a typo) — the destination phone number for sent messages
  • LocalTimestamp — the Windows timestamp of the message (learn more about Windows timestamp here and about timestamps in general here)

There is also an Attachments fields, which I guess is related to MMSes. This field will be ignored in our conversion.

What we want to do is convert the XML file in another XML file which is compatible with Android. The Android fields for a text message are not too different and include:

  • Address — the sender/recipient of the message (sender if the message is received, recipient if the message is sent)
  • Date — UNIX timestamp of the message, with milliseconds
  • Body — the message content
  • Type — a number indicating the type of the message (1 → received, 2 → sent)

I’ve written a simple Python script for this conversion. It is available as an open source project on GitHub, here. A ZIP of the repository is available here.

Clone the repository or download the ZIP, the run the main script with

python convert.py

in a cmd/terminal window. Make sure you have Python 2.7 installed.

The script will output a file called wp_messages.xml in a few seconds. If you’re running into issues when executing the Python script, please file an issue on GitHub and I‘ll be happy to help you as soon as I can.

If at the end of this guide you have more that one conversation for the same contact, uncomment and customize the lines in the script that add the country prefix to the phone numbers (you should have a bit of Python or programming knowledge for this).

Part 3: importing the messages in Android

For this step, we’ll need another application. It’s called “SMS Backup & Restore” and is free on the Play Store.

Before launching the app, transfer the generated wp_messages.xml file on your phone, in any folder.

Open the app, tap restore, follow the steps in the popup messages and import the SMSes after selecting the file.

A progress bar will show you the progress of the operation. It will take some minutes for this to complete, particularly if you have a lot of messages (8000+ in my case).

A summary will inform you of the number of failed imports at the end (9 in my case). Don’t worry, in most of the cases this is just because sometimes the “address number” is not a real number but an alias like “WhatsApp”, “Facebook”, and so on. Those messages apparently cannot be imported.


You can finally check if everything went ok by launching the system Messenger app.

If you have any issues with the procedure, or need help customizing the script, file an issue on GitHub (comments on this article will not receive replies, sorry).

Matteo Contrini

Written by

Italy. Student at University of Trento. https://contrini.it

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade