Monday, March 21, 2016

Exporting Firefox OS SMS or other data (Firefox OS migration part 2)

Introduction

Welcome back to the second part of the Firefox OS migration guide. Last time we migrated the Firefox OS Offline Calendar data, this time we will take a more general approach to export any kind of data, e.g. your SMS history.

Preparations

This article assumes you retrieved your user data from your Firefox OS device already - if you didn’t, please follow the guide in the article Exporting the Firefox OS Offline Calendar (Firefox OS migration part 1) up to step 5 first.

Checking what data is available

In the last article you may have been wondering what that Database name: field is for: It’s for getting the contents of any kind of data. The default value of b2g-calendar will get you the IndexedDB database containing the calendar data.

So let’s check which other databases exist. Unfortunately a website can’t access that data, but Firefox itself can:

  1. Open the website http://digitalimagecorp.de/software/firefox-os-data-exporter/ffosexporter.html like in the previous article (if you created a separate profile please use that profile to open the website!)
  2. Open the Firefox menu by clicking on the Open menu button at the top right of your browser.
  3. Click on DeveloperToggle Tools.
  4. A toolbar will open on the bottom of the browser. At the top right of that bar click on the gear icon (Toolbox Options).
  5. In the section Default Firefox Developer Tools check Storage.
  6. A new tab called Storage has appeared on the top of the toolbar now - click on it.
  7. You will find a section Indexed DB on the left. Click on it and also click on the http://digitalimagecorp.de entry.
  8. You will get a list of all databases you migrated initially.

If this guide was too confusing see the Mozilla manual on how to open the Storage Inspector.

Importing more data

You have probably backed up your complete device’s user data, so let’s see what else is there. Open the backup with your file manager and navigate to the directory containing several directories named like 1015+f+app+++clock.gaiamobile.org - those are the applications that used IndexedDB databases to store their data. You will also notice the folder called chrome: This one contains the data of the core Firefox OS applications like your SMS storage.

Now repeat Step 5 of the original tutorial, but this time copy the (complete) contents of the idb directories of the applications you are interested in into your newly created http+++digitalimagecorp.de/idb directory. Unfortunately several applications have files of the same name, so you cannot use them at the same time (you have to repeat Step 5 for each one your are interested in).

Working with the data

Now you can just check which databases are available using the Firefox Storage Inspector view from above. If you want to export any of those databases enter the name of the database in the Database name field and click on Export to get the contents as JSON output. There are numerous tools available on the web to transform JSON data into other formats (or you can write one yourself if a converter to your format is not available :-P).

Wait - what about my SMS data?

You will find those in the chrome directory of your backup. When you import those into Firefox you have to export the sms database, the required Object Store is also called sms.

If you own a Jolla phone or any other device based on Mer you can simply select Convert SMS data to commhistory-tools JSON file, save the file to your phone and import it with the command commhistory-tool import-json sms.json (Note: MMS messages are not supported by this tool unfortunately).

If you have an Android phone there seem to be several tools available to import SMS data from CSV files, so one simple solution would be to convert the JSON data into CSV. There are various converters for that available, but http://konklone.io/json/ looks very promising because it also processes all data locally on your PC (i.e. no data is sent to the server as of 2016-03-21).

Fin

This concludes my series of the Firefox OS migration guide. I hope you found it useful, and don’t hesitate to ask if you have any questions. (The Comments section is currently locked due to the massive spam amount, I hope I will be able to unlock it soon again with a better filter.)