Skip to content
forked from tmo1/sms-ie

SMS Import / Export is a simple Android app that imports and exports SMS messages from and to JSON files.

License

Notifications You must be signed in to change notification settings

nautilusx/sms-ie

 
 

Repository files navigation

SMS Import / Export

SMS Import / Export is a simple Android app that imports and exports SMS and MMS messages from and to JSON files. Root is not required. The current release is version 1.3.

Get it on F-Droid

Installation

SMS Import / Export is available from Github. The repository can be cloned and built locally, by importing it into Android Studio or other means. Prebuilt APK packages can be downloaded from the Releases page.

Usage

  • Import: Click the Import button, then select an import source.
  • Export: Click the Export button, then select an export destination.

These operations can take some time for large numbers of messages. The app will report the total number of SMS and MMS messages imported or exported upon successful conclusion.

By default, binary MMS data (such as images and videos) are exported. The user can choose to exclude them, which will often result in a file that is much smaller and more easily browsable by humans. (The checkbox is currently ignored on import.)

Permissions

To export messages, SMS Import / Export must be granted permission to read SMSs and Contacts (the need for the latter is explained below). The app will ask for these permissions on startup, if it does not already have them.

To import messages, SMS Import / Export must be the default messaging app. This is due to an Android design decision.

Warning: While an app is the default messaging app, it takes full responsibility for handling incoming SMS and MMS messages, and if does not store them, they will be lost. SMS Import / Export ignores incoming messages, so in order to avoid losing such messages, the device it is running on should be disconnected from the network (by putting it into airplane mode, or similar means) before the app is made the default messaging app, and only reconnected to the network after a proper messaging app is made the default.

Contacts

SMS messages include phone numbers ("addresses") but no further information about the communicating parties. The contact information displayed by Android is generated by cross-referencing message phone numbers with the device's Contacts database. When exporting messages, SMS Import / Export does this cross-referencing in order to include the contact name in its JSON output; this is why permission to read contacts in necessary. When importing, included contact names are ignored, since the app is (at least currently) not in the business of adding to or modifying the Android Contacts database. The best way to maintain the association of messages with contacts is to simply use Android's built in Contacts export / import functionality to transfer contacts to the device into which SMS Import / Export is importing messages.

JSON Structure

Following is the structure of the JSON currently exported by SMS Import / Export; this is subject to change in future versions of the app.

The exported JSON is an array of JSON objects representing messages, SMSs followed by MMSs. Each JSON message object contains a series of tag-value pairs taken directly from Android's internal message data / metadata structures, documented in the Android API Reference: SMS, MMS. In addition, SMS Import / Export adds some other tag-value pairs and child JSON objects, as described below.

SMS Messages

In SMS messages, the value of type specifies (among other things) the direction of the message: the two most common values are 1, denoting "inbox" (i.e., received), and 2, denoting "sent".

SMS messages contain a single address tag; depending on the message direction, this is either the sender or receiver address. SMS Import / Export attempts to look up the address in the Android Contacts database. If this is successful, a tag-value pair of the form "display_name": "Alice" is added to the SMS message object.

MMS Messages

MMS message objects have the following additions to the tag-value pairs of their internal Android MMS representation:

  • A tag-value pair of the form "sender_address": { ... }

  • A tag-value pair of the form "recipient_addresses": [ { ... }, { ... } ]. The child JSON objects associated with sender_address and recipient_addresses contain a series of tag-value pairs taken directly from Android's internal MMS address structure, documented here, plus possibly a single added tag-value pair of the form "display_name": "Alice", as with SMS messages.

  • A tag-value pair of the form "parts": [ { ... }, { ... }], where the child JSON objects contain a series of tag-value pairs taken directly from Android's internal MMS part structure, documented here, plus, for parts containing binary data (assuming binary data inclusion is checked), a tag-value pair of the form "binary_data": "<Base64 encoded binary data>".

Limitations

Currently, no deduplication is done. For example, if messages are exported and then immediately reimported, the device will then contain two copies of every message.

sms-db

SMS Import / Export is a sibling project to sms-db, a Linux tool to build an SQLite database out of collections of SMS and MMS messages in various formats. sms-db can import JSON files created by SMS Import / Export, and it can export its database to JSON files that can be imported by SMS Import / Export.

Background

Coming from a procedural, command line interface, synchronous, Linux, Perl and Python background, the development of SMS Import / Export served as a crash course in object-oriented, graphical user interface, asynchronous, Android, Kotlin programming, and consequently entailed a fair amount of amateurishness and cargo cult programming. After much work and learning, however, the app does seem to function correctly and effectively.

License

SMS Import / Export is free / open source software, released under the terms of the GNU GPLv3

About

SMS Import / Export is a simple Android app that imports and exports SMS messages from and to JSON files.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Kotlin 100.0%