Guide to transfer text messages from any phone to a FIG.
UPDATE: After this guide was released, I decided to be very nice and modify the SMS-IE (SMS Import / Export) app to work on the flip phones with their messed up document pickers and tiny screens. You can now install the modified SMS Import / Export app, create a backup *.zip file, and load that backup on to a FIG without modifying, converting, or using an intermediate device. I’m leaving the original guide below because noobies may find it a useful intro to apk modding. Note: The modifications only target messages. Call log, contacts, and block numbers still function exactly as they did in the original app. (Maybe I’ll get to those one day). Import and Export messages now offers an option to use “default location”, which is your device’s download folder. If you choose to use default location, you will not have to use your device’s document picker.
————————ORIGINAL—GUIDE————————–
OK chevra, I figured out something that works, and it is time to share the knowledge.
While this guide focuses specifically in obtaining a backup in the format used by the FIG, it also covers how to extract the messages from some phones that make extraction difficult. It is quite useful for extracting and restoring from or to - e.g., a Kyocera E4810 - as well.
Prerequisites
You will need to be able to install an SMS backup app on the source device. If the source device is locked and you have no way to install the app, this guide will not work for you. You may also need an intermediate device to convert the backup format.
Introduction
This guide is divided into three phases.
-
Extracting the messages from your old phone.
-
Converting the messages you extracted into a format that can be loaded onto the FIG.
-
Loading the messages onto the FIG.
Phase 1
Extracting the messages from your old phone.
· Abstract: Install a backup up app and create a backup.
· Reality Check: Installing a backup app and using it may be difficult on many flip phones.
The FIG phone’s native Backup & Restore tool seems to use tmo1’s sms-ie format (still waiting to hear back from FIG about their GPLv3 sources, see here), which stores text messages in an NDJSON (Newline Delimited JSON – a list of single line JSON objects) format. The NDJSON data is zipped together with a folder called data which contains “parts”, the encoded multimedia attached to MMS messages. Backups from this app are cross compatible with FIG’s Backup & Restore tool.
Quick Fix: Ideally, you would install one of sms-ie’s releases on your source device, make a backup, transfer the resulting zip file to your target (FIG) device, and import it using the FIG tool. If this approach works for you, skip straight to phase 3.
However, not so simple. The app does not work very well on many flip phones. For instance, when tested on a Kyocera E4811, it crashed out every time Export Messages was pressed. Useless. I’m sure someone can take the source, and build a version that works on this device – but I’m already donating enough time just by writing this guide. If someone wants to do that, and be mezake es harabim, then kol hakavod (google it).
So here is the Workaround: Use Synctech’s SMS Backup & Restore app to create an XML backup, and convert that backup to the NDJSON format used by FIG. Since the Kyocera’s native document picker does not allow selecting directories (only files) we will have to use the default local backup location – which is the app’s data folder. This folder is protected, so let’s make a quick mod to the app to grant us ADB access to the folder. If your device allows you to choose a folder in the document picker, skip to step 11.
-
Download the free version of the SMS Backup & Restore app from Synctech’s website linked above, or from your favorite APK provider.
-
Use apktool to decompile the app. You do not need to decompile the sources, only the resources. Open a terminal in the same folder you downloaded the apk to (the “work” folder – just type `cmd` into the address bar and press enter) and run the following command:
apktool d -s SMSBackupRestore-freeProductionRelease-xxx.apk
(Replace xxx with the real version name).
Leave the terminal open.
[You can easily install apktool globally using chocolatey. This will also install and configure JAVA if you don’t already have it, which is a prerequisite for apktool and is also required later in this guide.
· Visit Installing Chocolatey and grab the powershell installer command.
· Open powershell as administrator, and run the chocolatey installer by pasting the command.
· After completing the installation, type refreshenv in powershell.
· Run choco install apktool -y to install apktool globally.
· After install completes, open a new terminal in your work folder.]
-
Open the AndroidManifest.xml file from your output folder (it has the same name as the original apk) in your favorite editor, and add
android:debuggable=“true”attribute to the<application>tag. -
If you’re sourcing from an LG device, you may need to apply the package name exploit. Find the
android:package=“com.riteshsahu.SMSBackupRestore”attribute in the<manifest>tag and change it to“com.client.riteshsahu.SMSBackupRestore”. -
Optionally, for quick “koshering”, you can remove the internet permission by deleting this line:
<uses-permission android:name="android.permission.INTERNET" />
- Time to re-compile. Save your changes to AndroidManifest.xml and back in the terminal, run:
apktool b SMSBackupRestore-freeProductionRelease-xxx
(Again, replace xxx with the real version name).
-
After recompiling completes, open the output folder, and find the modified apk in the dist folder.
-
You will need to sign the modded app, for that you will need to use some tools that come with JAVA. These should be available globally in your terminal. First, you will need a keystore:
· Open a terminal in the dist folder (type cmd in the address bar, or right click while holding shift and choose open in terminal for powershell).
· Run this command to generate a keystore:
keytool -genkeypair -keystore my.jks -alias key -keyalg RSA -keysize 2048 -validity 10000
· When prompted, enter a minimum 6-character password. It will then prompt you to re-enter it. Don’t forget this password.
· It will then ask you for a lot of info. You can just press enter a bunch of times to use the default values.
· Finally, it will ask you:
Is CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown correct?
You must type “y” and press [ENTER] to continue. It will then generate your keystore file, called my.jks.
- You are ready to sign the app. Type and run following command in the terminal you just used, replacing xxx with the correct apk file name:
jarsigner -keystore my.jks -sigalg SHA1withRSA -digestalg SHA1 SMSBackupRestore-freeProductionRelease-xxx.apk key
-
It will prompt you for the keystore password, (which they refer to as passphrase). Enter the password you created above. You will get output letting you know that your apk (referred to here as `jar`) was signed, and a warning that you used a horribly weak signature algorithm.
-
Let’s install the apk. To do so, you will need adb. (If you don’t have it already, you shouldn’t be doing this – but still, you can easily install it using
choco install adb -yin an administrator terminal. After installing, you will need to open a new terminal in the dist folder to use adb. You will also need to enable developer options on your source device, turn on USB debugging, and allow your PC access. Google is your friend.) Install the apk using the-gflag, replacing xxx with the correct apk file name:
adb install -g SMSBackupRestore-freeProductionRelease-xxx.apk
- Now we create the backup. Launch the app on the device using your app launcher or just run:
adb shell monkey -p com.riteshsahu.SMSBackupRestore -c android.intent.category.LAUNCHER 1
(If you changed the package name, make the same changes in the above command.)
-
Click “get started”. It may be easier to perform these steps on your PC by using scrcpy (
choco install scrcpy -yfrom an admin terminal, after install completes launch by pressing [WIN]+R, type scrcpy, press [ENTER]). -
What a moment for the splash screen, then tap the menu button in the top left corner.
-
Hit “Back up now”.
-
Scroll down and press “More Backup Locations”.
-
Scroll down to “Your Phone” and toggle it on.
-
If you skipped modding the app because your device supports choosing a directory in the document picker, then tap “Your own folder” and choose the output folder. Otherwise, leave it at “Internal app folder”.
-
Press “Ok”.
-
Tap “Back Up” at the bottom of the screen. It will ask you about creating a local only backup, tap “Yes”.
-
Wait for the backup to complete. If your are a prolific texter or have had the phone for a while – especially if there are a lot of MMS messages – this will take a long time.
-
If you chose your own output source, pull it to the working directory. For instance if you save it in the downloads folder of your phone, run:
adb pull /sdcard/download. If you used the internal app folder, run the following command:
adb shell "run-as com.riteshsahu.SMSBackupRestore cp -r files /sdcard/SMSBackupRestore" && adb pull /sdcard/SMSBackupRestore
(If you modified the package name, update the command as well.)
-
Find the SMS backup XML file. If you used your own folder, the folder will have been pulled to your work directory on your PC. Open that folder and look for an XML file called something like sms-timestamp.xml. If you used the internal app folder, open the SMSBackupRestore folder in your work folder and look in the files folder.
-
This file contains a backup of all your SMS and MMS messages in Synctech’s XML format.
Restoring the backup on a different device.
If you would like to transfer these messages to a different phone (not a FIG) you will need to install the SMS Backup & Restore app on that device and use it to restore the backup. Follow the instructions in the first half of phase 2.
Phase 2
Converting the messages you extracted into a format that can be loaded onto the FIG.
· Abstract: “Normalize” the data into a format that the FIG can read.
· Reality Check: You may need an intermediate device, emulator, or specialized software.
Now that you have a backup of your SMS data in XML format, you will need to convert it to NDJSON format in order to load it on to the FIG phone. You can still use this backup to move your messages to any other phone the supports installing apps. Follow the steps below to do that. In order to convert the XML data to NDJSON for the FIG you will need a second phone that supports both the Synctech app and tmo1’s app, linked at the top.
The quickest way to do this would’ve been to adapt tmo1’s app to work on flip phones. After that, easier still would’ve been to write a simple pc tool to convert between NDJSON and XML. I may still do that, or if anyone wants they can do it themselves – just please post back here. In the meantime, you will need an intermediate device that supports both apps – a phone, tablet (with telephony), emulator, or virtual machine.
Restore the backup on an intermediate or final device other than FIG.
-
Install the (modified) apk onto your intermediate (or target) device. If the target device does not have a document picker that supports choosing directories, you will need to push the XML file to the internal app directory – requiring the modified app. If you did not yet perform the modifications, or if you are transferring to an LG device, build yourself an apk that will work by following the modification steps above, steps 1 – 11. The rest of these steps will assume you are using a modified apk.
-
Push your XML backup to the new device. Open a terminal in your root work folder, the one containing the folder you pulled from the source device.
adb push SMSBackupRestore /sdcard
If you used your own folder on the source device, use this command instead:
adb push <name_of_your_folder> /sdcard/SMSBackupRestore/files
-
Replace
<name_of_your_folder>with (…you guessed it,) the name of your folder. -
Open the SMS Backup & Restore app.
-
Tap the menu button in the top left corner.
-
Tap “Restore”.
-
If your backup is not already selected, then we will need to find it.
· Ensure the messages switch is ticked on.
· If the app launches the devices native document picker, and the picker does not support choosing directories, run:
adb shell pm disable-user --user 0 com.android.documentsui
This command disables the native document picker, and forces SMS Backup & Restore to fall back on its internal picker, (which seems to be restricted to the /data partition).
Otherwise, find the backup file and select it.
· To move the backup to the app’s internal folder – so it can be found in the app’s native picker,
adb shell "run-as com.riteshsahu.SMSBackupRestore cp -r /sdcard/SMSBackupRestore/* files"
You may need to close and re-open the picker to see the changes.
· Tap Select Another Backup.
· Under the local tab, you should see your backup. Select it and tap “Ok”.
-
Scroll down and tap “Restore”.
-
The app will ask to be temporarily set as the default SMS app. Hit “OK”. If your device crashes, or has no native UI to handle the change (LG devices), use adb to set the default sms app to this app’s package name (Google is your friend).
-
Choose SMS Backup & Restore from the list, and set as default.
-
When the restore completes, make sure you set your normal SMS app back to default.
Now, make an NDJSON zipped backup using tmo1’s app.
-
Download tmo1’s app, sms-ie, from the F-Droid page.
-
Install the app on the target / intermediate device.
-
Open the SMS Import / Export app.
-
Tap “Export”. If the app does not immediately crash, you are in business.
-
Save resulting ZIP file to your PC.
Phase 3
Loading the messages onto the FIG.
· Abstract: Import the backup using FIG’s native Backup & Restore tool.
· Reality Check: This may take a very long time (~12h), but you can leave it unattended.
Restore the NDJSON backup to your FIG phone.
-
Connect your FIG phone to your PC, and copy the ZIP file to the phone.
-
Go to Settings > Backup & Restore and tap Import.
-
Find and import your ZIP folder (may take several hours).
-
Walla! +1 if I helped you. FIG people, send me a check.