This is just a little note related to my last blog about Jolla. I wrote that I’m pretty fine with messaging application although I don’t have many SMS yet in my phone. Well, I fixed that 🙂 I imported all my SMS messages from the backup of my Andriod phone.
I searched around and I found really interesting thread on talk.maemo.org that describes how to import SMS from n900. As they are doing it via csv, it was easy to put together a simple one-liner that would produce the csv from my SMS database. Now how to do it…
My database used to be at /data/data/com.android.providers.telephony/databases/mmssms.db
. You can get it from your phone to your PC for example with
adb pull \ /data/data/com.android.providers.telephony/databases/mmssms.db
Now download the script and get your csv
curl http://susepaste.org/view/raw/49179811 > sms_export sh ./sms_export mmssms.db > sms.csv
What is left is to fix all the extra newlines in SMS. But without fixing them, the import program just imports messages without newlines which was good enough for me as most people don’t use new lines in SMS.
Now time to play with Jolla and that part is simple thanks to Merlin1991 who wrote importer application. I will assume that your are sshed on your Jolla and and you copied your csv file over to the current directory. Now what is left on device is following:
curl http://cdnm.at/~christian/Harmattan-SMS-Boat/jollaImport \ > jollaImport chmod a+rx jollaImport ./jollaImport -s sms.csv
And SMSes are transfered from Android to Jolla 🙂 Many thanks to Merlin1991.
4 comments
kewl4u says:
September 23, 2014 at 13:50 (UTC 2)
Hello, I’ve tried this process with a csv file extracted from Iphone. Should this process work also for such csv files? The problem is that the csv’s extracted from Iphone are not a concise database, but a collection of csv files from each sender / phone number.
I’ve tried this code:
curl http://cdnm.at/~christian/Harmattan-SMS-Boat/jollaImport \
> jollaImport
chmod a+rx jollaImport
./jollaImport -s sms.csv
and I’m puzzled whethre the first command line. Is this one line or actually two lines?
The last command ./jollaImport -s sms.csv gives an error that jollaImport is a directory.
Any help?
Thanks!
Michal Hrušecký says:
October 6, 2014 at 09:44 (UTC 2)
Well, it’s one line divided into two for readability. You can do
curl url > file
or you can add\
followed by newline. As for importing csv from iPhone, I doubt they will be the same as the one used by the importer, you might need to check you csv against importer application and probably modify it to support iPhone csv as well.Artur says:
February 27, 2015 at 17:30 (UTC 2)
Hi there,
many thanks for that post. Really helped getting my sms to my phone.
You say “What is left is to fix all the extra newlines in SMS.”
On https://github.com/merlin1991/Harmattan-SMS-Boat in the README section it is said, that “lines starting with a space are a continuation of the last sms text.”.
I modified your really helpful one liner to just reproduce the expected csv file that is needed for importing.
#!/bin/sh
sqlite3 “$1” \
“select address,type,datetime(date/1000, ‘unixepoch’,’localtime’),datetime(date/1000, ‘unixepoch’,’localtime’),body from sms;” | \
sed -e ‘s;^\([^|]\+\)|1|\(.*\);\1|IN|\2;’ -e ‘s;^\([^|]\+\)|2|\(.*\);\1|OUT|\2;’ -e ‘/^[A-Za-z0-9+]*|[IN|OUT]/! s;^; ;’ | \
sed ‘s/|/;/g’
In my understanding my part to the sed comand excludes every line that doesn’t begin with the metadata for the sms and inserts a space in front of it. As I had some numbers without leading + and senders that just appeared as e.g. “DHL” I had to add those char ranges too.
Michal Hrušecký says:
February 27, 2015 at 21:44 (UTC 2)
Glad it helped and thanks for your comment! Might help others as well!!! 🙂