Mobile device users often wonder about the physical location of their messages. This is necessary to create manual backups, restore lost correspondence, or simply out of technical curiosity. However, finding the answer to the question of which folder contains SMS messages on Android is not as simple as it might seem at first glance.

The fact is that the architecture of the operating system Android implies strict differentiation of access rights. Regular applications and file managers do not have direct access to system databases, where your text messages are located. The system protects this data from accidental deletion or theft by malware.

However, information about the storage structure exists and can be accessed if certain conditions are met. In this article, we will analyze in detail system paths, file formats and methods of retrieving messages for both users with root access and for those who prefer standard security methods.

System architecture for storing messages

The basis of SMS and MMS is a database SQLite. These are not ordinary text files that you can open in Notepad and read. All incoming and outgoing messages are recorded in a special database file, which the system processes through the appropriate services.

The physical path to this file is standard for the vast majority of devices based on Android. It is located in a protected section of memory, which is not accessible to the user by default. The full path usually looks like this:

/data/data/com.android.providers.telephony/databases/

The file is located in this directory mmssms.db. It contains tables with message text, sender numbers, dates, delivery statuses and types (incoming/outgoing). Without special privileges, you will not even be able to see the contents of this folder through a standard explorer.

โš ๏ธ Attention: Direct editing of the file mmssms.db without creating a backup copy can lead to a complete loss of the entire correspondence history and failure of the Messages application.

In addition to the main database, there may be log files or cache, but they do not contain the complete correspondence history in a readable form. The main array of data is always concentrated in the specified database file.

Access to data without root access

Most users do not have and do not want to obtain superuser (root) rights on their device. This is a good solution from a security point of view, but it limits direct access to system folders. How then can you see or save your SMS?

The standard file manager pre-installed on a smartphone will show you only the internal memory and SD card. The path /data/ will be invisible to him. However, you can use built-in export functions or third-party applications that work through the system API, and not through direct file access.

To create a copy of messages without root access, it is recommended to use specialized utilities from Google Play. They request permission to access the SMS and create a backup copy in XML or JSONformat, which can already be found in an accessible folder.

  • ๐Ÿ“ฑ The SMS Backup & Restore application saves a copy to internal memory or the cloud.
  • ๐Ÿ”„ Google Drive can automatically sync messages when setting up system backup.
  • ๐Ÿ’พ Export files are usually saved in the folder /Android/data/ or the root of the internal memory.

This approach is safe and does not require intervention in system files. You get access to data in a convenient format that can be transferred to another phone or computer.

๐Ÿ“Š How do you prefer to store backups?
In the Google cloud
On an SD card
On a computer
Not I make copies

Working with the file system with Root

If your device has an unlocked bootloader and installed root access, the situation changes dramatically. You get full control over the file system and can directly interact with system directories.

To navigate system folders, you will need an advanced file manager that supports working with superuser rights. An excellent example is an application Root Explorer or Solid Explorer with root mode enabled.

After granting access rights, you can navigate to the path /data/data/com.android.providers.telephony/databases/. Here you will see a file mmssms.db and possibly a log file mmssms.db-journal. Copying this file to external media will allow you to save the complete database of messages.

โ˜‘๏ธ Checking access to system files

Done: 0 / 4

It is important to understand that simply copying a file is not enough if you plan to edit it. To view the contents of the database on a computer, you will need special apps that can read the format SQLite, for example, DB Browser for SQLite.

โš ๏ธ Attention: When working with system files through root access, any error can lead to the device being โ€œbrickedโ€ or data loss. Proceed with extreme caution.

Analysis of the mmssms.db database structure

The file mmssms.db is a relational database. It consists of several tables, each of which is responsible for a certain aspect of information storage. Understanding the structure will help you correctly extract the data you need.

The main table containing the text of the messages is usually called sms. It stores fields with the sender's address, message body, sending date and other metadata. Separate tables may exist for MMS, drafts and settings for correspondence threads.

When opening a file through a database editor, you will see the following approximate field structure:

Field name Data type Description of contents
_id INTEGER Unique message identifier
address TEXT Phone number of the sender or recipient
body TEXT Message text itself
date INTEGER Time stamp in Unix format (ms)
type INTEGER Message type (1 - incoming, 2 - outgoing)

Knowing these parameters, you can generate SQL queries for sampling the data. For example, you can filter messages from a specific contact or for a specific period of time.

Date format in the database

The date in the database is not stored in the usual form DD.MM.YYYY, but as the number of milliseconds that have passed since January 1, 1970. To be read by a person, it needs to be converted using online Unix Time converters or functions in the DBMS.

Do not try to open this file in a text editor like Notepad. You will only see a set of unreadable symbols and hieroglyphs, since the data is stored in binary form.

Alternative methods for retrieving correspondence

Direct access to folders is not the only way to get your data. There are methods that allow you to export messages in a more convenient way, bypassing the need to delve into the system jungle.

One โ€‹โ€‹of these methods is to use the command ADB (Android Debug Bridge). This developer tool allows you to interact with your phone via a computer using a USB cable. With its help, you can unload the database without even installing a file manager on the device itself.

To do this, you need to enable USB debugging in the menu For developers and run the command in the computer terminal:

adb pull /data/data/com.android.providers.telephony/databases/mmssms.db

This command will copy the database file from the internal memory of the phone to current folder on your computer. Of course, to perform this operation you will also need root access on the device, otherwise the command will return an access error.

  • ๐Ÿ’ป The ADB method is convenient for bulk uploading data to a PC.
  • ๐Ÿ”Œ A stable USB connection and installed drivers are required.
  • โš™๏ธ Allows automation backup process through scripts.

Another option is to use the functions of the messenger itself. Some applications allow you to send your correspondence history by email or save it to the developer's cloud profile.

โš ๏ธ Attention: Menu interfaces and item names may differ depending on the version of Android and the manufacturer's shell (MIUI, OneUI, ColorOS). Always check that the paths in the documentation for your model are up to date.

Restoring messages from a backup

Knowing where SMS are stored is useful not only for retrieving them, but also for restoring them. If you have lost messages after a factory reset or crash, having a file mmssms.db or an XML copy can save the situation.

To restore from a database file SQLite you will again need root access. The file must be returned back to the directory /data/data/com.android.providers.telephony/databases/by replacing the current file (after making a copy of it).

After replacing the file, it is critical to change the access rights (permissions). The file must be owned by the user radio or system (depending on the Android version) and have read-write permissions. If the rights are set incorrectly, the messages application will not be able to open the database and will constantly crash.

๐Ÿ’ก

Before restoring the database, be sure to completely stop the "Messages" application through the system settings (Applications โ†’ Messages โ†’ Stop), otherwise the changes may not be applied correctly.

In the case of XML copies, the process is simpler. Specialized recovery applications will read the file from available memory and return messages to the database through the system API, without requiring direct file replacement.

๐Ÿ’ก

The most reliable way to save SMS is regular automatic backup to the cloud or external media in XML format, since working with raw database files carries high risks.

Frequently asked questions (FAQ)

Is it possible to read the mmssms.db file on a computer without special apps?

No, this file has a binary SQLite database structure. To view it and read the text of messages, you must use specialized software, for example, DB Browser for SQLite or analogs.

Where are SMS stored on the memory card (SD card)?

By default, the system does not store messages on the SD card. They are always located in the internal memory in the system partition. You can only save a backup copy created by a third-party application to a memory card.

Will SMS messages be deleted if you delete the mmssms.db file?

Yes, deleting this file will lead to the complete loss of the entire correspondence history. The system may create a new empty file the next time you launch the application, but it will be impossible to return old messages without a copy.

How to find the folder with SMS on Samsung or Xiaomi?

The path to the files is the same for all brands: /data/data/com.android.providers.telephony/databases/. Differences may only be in the names of shell applications, but the system telephony provider remains standard.

Is it safe to give root access to access this folder?

Granting root access in itself reduces the level of system security. File managers should be given access to system folders only to trusted applications and only for the duration of the task.