biqqles / textricate

Export messages from Textra to XML
BSD Zero Clause License
5 stars 1 forks source link
script

textricate

textricate is a script which extracts SMS messages from Textra SMS and exports them to a format understood by the popular SMS Backup and Restore, in a similar vein to several existing projects. However, unlike these solutions, textricate maintains encoding (handling emojis properly) and additionally attempts to repair a database damaged by previous usages of these scripts by removing duplicate messages and fixing encoding errors where possible. SMS Backup and Restore can be used to write the resulting XML file to the Android SMS provider (system database).

Why this is useful

On initialisation, Textra takes a copy of Android's SMS database in its own database for improved performance. Several situations can lead to this database becoming desynchronised from the Android provider and your messages being stuck inside Textra, the most obvious of which being that you have a backup of Textra's app data but not your messages themselves. textricate allows you to extract messages from Textra's database and write them to the system database so that they can be used by other apps.

How to use

  1. Ensure Python 3 and ADB are installed
  2. Clone or download this repo
  3. Install the script's sole dependency, ftfy, using pip (i.e. python3 -m pip install ftfy)
  4. Copy messages.db from /data/data/com.textra/databases/ on your device to the same directory as the script using ADB (i.e. adb pull /data/data/com.textra/databases/messages.db)
  5. Execute python3 textricate.py and transfer the generated XML file back to your device (e.g. adb push textricate.xml /sdcard/)
  6. Restore with SMS Backup and Restore
  7. Use Textra > Settings > About > Resync Textra to force Textra to load a new copy of its database from the system provider.