import iPhone sms into replicant 4.2 0003 on Samsung

Added by Fil Lupin over 3 years ago

A few words to those who want to understand the context.
It seems the mmssms.db SQLite database format can change at every new version of android (for instance, it is version 58 in 4.1.2, 57 in Replicant 4.2 0003, even if it is based on 4.2.2). SMS app use a pragma into mmssms.db SQLite script to identify this version ("PRAGMA user_version = 58;")

So any script used to convert iPhone sms to android sms should take into account IOS version and android version, to check if it can do conversion, and if yes, import consistently IOS sms and export them consistently into android sms.

However, only the interface java methods are documented, but SQLite mmssms.db format is not documented. You will find as attachment the information I gathered when attempting to understand this mmssms.db format.

To import your sms and mms into your new Replicant installed phone, here are the steps to follow. This
recap is written based on subject where I wrote several tries before succedding.

I found a method to convert sms and mms but there are some constraints. You will need for this :
- Samsung Smart Switch (proprietary software), to install on Mac OS or windows :
- an iPhone and iTunes to save your SMS and MMS
- a Samsung phone with android 4.1.2 at least (Samsung smart switch does not work on older versions), you can upgrade your firmware if necessary
- adb (Android Debug Bridge) : (français) or (english)
- sqlite : or your favorite packet manager

Steps to follow
1°) connect your iPhone to your PC and save sms & mms from the iPhone with iTunes
2°) disconnect your Samsung from your PC and launch Samsung Smart Switch ( on your computer
3°) connect the Samsung phone on your computer and import sms & mms on the Samsung phone
4°) switch off the Samsung phone, and then boot it on recovery mode (Vol Up+Home+Power)
5°) execute "adb pull /data/data/" and in a different directory "adb pull /data/data/" to get sms and attachements in two directories
6°) into the directory with mmssms.db, execute "sqlite3 mmssms.db" and then ".read transformation.sql" ".backup mmssms_replicant.db" and ".quit"
7°) execute "adb push mmssms_replicant.db /data/data/"
8°) in the directory with attachments execute "for i in *; do adb push $i /data/data/; done"
9°) execute "adb shell rm /data/data/" to delete "mmssms.db-journal" and rebuild a new correct one
10°) reboot your phone and launch message app, then just wait that your replicant rebuild the "mmssms.db-journal"

I hope this is complete and understandable, please let me know it you detect any problem using this.

Replies (1)

RE: import iPhone sms into replicant 4.2 0003 on Samsung - Added by Fil Lupin about 3 years ago

/!\ issue with conversion of threads with several contacts.

I recently encountered an issue for sms threads sent to several contacts : it seems that the sms is only sent to the first contact. This behaviour is only observed on threads which were already existing before converting.

The following SQL request on the sqlite DB allows to check the possibly affected threads :

SELECT DISTINCT canonical_addresses.address FROM canonical_addresses, sms WHERE canonical_addresses._id = sms.thread_id AND canonical_addresses.address LIKE "%,%"

One unsatisfying way to solve this problem is to delete threads with multiple contacts. Then a new thread can be created without the problem.
I actually investigate this point but am not sure of anything yet.