Have you ever wondered where exactly your smartphone Android stores all sent and received SMS? These messages do not just hang on the air - they are recorded in a secure database, access to which is limited even for the owner of the device. Knowing the exact location of SMS files can be useful in a variety of situations: from backing up important correspondence to forensic examination or recovering deleted messages.
Unlike iOSwhere backups are created via iTunes or iCloud, Android does not offer built-in tools for direct export SMS to a readable format. However, this does not mean that the data is not available. In this article we will look at:
- ๐ Physical location SMS databases in the file system Android (including paths for different OS versions).
- ๐ Access methods to a file without rights
rootand with them. - ๐ ๏ธ Tools to retrieve, backup and analyze messages (including ADB, SQLite and specialized applications).
- โ ๏ธ Legal and technical risksrelated to working with other people's SMS.
It is important to understand that working with system files Android requires caution. Incorrect actions may result in data loss or device malfunction. If your goal is simply to save correspondence, consider specialized backup applications (they will also be discussed below).
1. Where SMS are stored in the Android file system: exact path
All SMS messages in Android are stored in a database SQLite called mmssms.db (in old versions) or telephony.db (in new ones). This file is located in a protected system folder, which can only be accessed by applications with the appropriate permissions (for example, the standard application "Messages").
The full path to the file depends on the version Android:
- ๐ฑ Android 10 and later:
/data/user_de/0/com.android.providers.telephony/databases/telephony.db - ๐ฑ Android 7โ9:
/data/data/com.android.providers.telephony/databases/mmssms.db - ๐ฑ Android 4โ6:
/data/data/com.android.providers.telephony/databases/mmssms.db(sometimes duplicated in/data/com.android.providers.telephony/...)
Inside the database, messages are stored in a table sms, where each SMS is represented as a record with the fields:
- ๐ข
_idโ unique message identifier. - ๐
addressโ phone number of the sender/recipient. - ๐ฌ
bodyโ message text. - โฑ๏ธ
dateโ timestamp (in milliseconds since 1970). - ๐ค
typeโ message type (1 = incoming, 2 = outgoing, 3 = draft, etc.).
You can view the database structure using any SQLite browser (for example, DB Browser for SQLite), but to do this, you first need to extract the file from the device. Without rights root this is difficult to do, but it is possible - more on that later.
2. How to access the SMS database without root access
If your device does not have rights root, you can extract the file from SMS in several ways. All of them require USB debugging to be enabled and drivers installed. The most reliable method is to use USB debugging. Here are the step-by-step guide: USB debugging and installed drivers ADB.
The most reliable method is to use ADB (Android Debug Bridge). Here are the step-by-step guide:
Enable USB debugging in Settings โ About phone โ Build number (press 7 times)|Connect the phone to the PC and confirm trust in the computer|Install ADB (included Android SDK Platform-Tools)|Open the command line in the folder c ADB
-->
Next, run the commands:
adb backup -f sms_backup.ab com.android.providers.telephony
adb pull /sdcard/sms_backup.ab
This command creates a backup copy of application data Telephony Provider (including SMS) to a file sms_backup.ab. However, the method has limitations:
- โ The file
.abis encrypted - to extract the data you will need a tool like abe (Android Backup Extractor). - โ Not all manufacturers support
adb backup(for example, Xiaomi i Huawei this function is often blocked). - โ Messages from third-party instant messengers may not be included in the backup (for example, Google Messages or Samsung Messages).
An alternative way is to use SMS backup applications that export messages to readable formats (.xml, .csv or .json). Popular options:
- ๐ฑ SMS Backup & Restore (saves in
.xml, supports cloud storage). - ๐ฑ Super Backup & Restore (exports to
.csv, works withoutroot). - ๐ฑ MyPhoneExplorer (allows you to manage SMS from a PC via USB/Wi-Fi).
adb shell content query --uri content://sms/ โit will display a list of all SMS directly to the console (but does not save to a file).-->
3. Extracting SMS with root access: full access
If your device has rights root, the process of extracting SMS is simplified. You can directly copy the database file or run SQL queries against it.
To copy the database file, do:
adb shellsu
cp /data/user_de/0/com.android.providers.telephony/databases/telephony.db /sdcard/
exit
exit
adb pull /sdcard/telephony.db
Now the file telephony.db is on your PC. Open it using DB Browser for SQLite or any other app for working with SQLite. To view all messages, run the request:
SELECT address, body, date, type FROM sms ORDER BY date DESC;
If you only need messages from a specific number, use:
SELECT * FROM sms WHERE address LIKE '%79123456789%';
With root-access you can also:
- ๐ Recover deleted SMS (if they have not yet been overwritten).
- ๐ Export data to
.csvfor analysis. - ๐ง Modify the database (for example, delete spam en masse).
Even with root access, it is not recommended to edit the SMS database directly - this can lead to data loss or malfunction of the standard application "Messages".
To automate the process, you can use scripts on Python with the library sqlite3. Example script for exporting SMS to .csv:
import sqlite3import csv
conn = sqlite3.connect('telephony.db')
cursor = conn.cursor()
cursor.execute("SELECT address, body, datetime(date/1000, 'unixepoch'), type FROM sms")
with open('sms_export.csv', 'w', newline='') as f:
writer = csv.writer(f)
writer.writerow(['Number', 'Message', 'Date', 'Type'])
writer.writerows(cursor.fetchall())
conn.close()
4. Features of SMS storage on devices from different manufacturers
Not all manufacturers adhere to the standard SMS storage scheme. Some brands modify Android so that the path to the database or its structure is different. Let's consider the key features:
| Manufacturer | Features of SMS storage | Additional nuances |
|---|---|---|
| Samsung | Uses its own application Samsung Messages, but the data is still stored in telephony.db. |
Backups are created via Samsung Cloud or Smart Switch. |
| Xiaomi | The path to the database may differ: /data/user/0/com.android.providers.telephony/.... |
Often blocks adb backup. To access you need root or Mi Unlock Tool. |
| Huawei | In new models (with EMUI 10+) SMS can be stored in encrypted form. | Retrieval requires Huawei Backup or specialized software. |
| Google Pixel | Standard structure Android, but the application Google Messages can synchronize SMS with your account Google. | Synchronized messages are available on messages.google.com. |
On devices with MIUI (for example, Redmi or POCO) the path to the database may look like this:
/data/user/0/com.android.providers.telephony/databases/telephony.db
If you are working with the device Samsung, please note that some models use Knox a security system that can block access to system files even with rootrights. In such cases, the only reliable way is to use official backup tools.
How to bypass Xiaomi restrictions without root?
On some devices Xiaomi you can temporarily unlock access to system files through the mode EDL (Emergency Download Mode). However, this requires a special cable and knowledge of commands Fastboot. The method is risky and can lead to hard brick (irreversible damage to the device), so it is not recommended for beginners.
5. Recovering deleted SMS: is it possible?
If messages have been deleted, their recovery depends on several factors:
- โณ Time: The sooner you start recovery, the higher the chances. New data may overwrite deleted SMS.
- ๐ Backups copies: If automatic backup is enabled (for example, via Google Drive or Samsung Cloud), messages can be restored from there.
- ๐ ๏ธ Root access: Without it, the chances are minimal.
C root-with rights, you can try the following methods:
- ๐ Use SQLite editor to search for "ghost" records in the database (sometimes the data remains, but is marked as deleted).
- ๐พ Scan the device memory using DiskDigger or GT Recovery (does not work on all devices).
- ๐ฑ Restore a backup copy
telephony.dbfrom an old backup (if there is one).
Without root the only reliable way is to check cloud backups. For example, if you used SMS Backup & Restore, check the export folder on Google Drive or in local storage.
On devices with Android 10+ try to find deleted SMS via Google Messages. If synchronization has been enabled, messages may be saved in the archive on servers Google (available at the link messages.google.com).
Important: recovery of deleted SMS on modern devices with encryption (for example Samsung Knox or File-Based Encryption v Android 11+) is almost impossible without specialized equipment. In such cases, it is better to contact professionals in the field of digital forensics.
6. Legal and ethical aspects of working with SMS
Access to SMS messages is not only a technical, but also a legal issue. In most countries, viewing other people's messages without consent is considered a violation of the law on confidentiality of correspondence.
What you need to know:
- ๐ Personal information: SMS may contain confidential information (passwords, bank data, personal correspondence). Their distribution without the ownerโs consent is punishable by law. data-i="205">Personal data
- โ๏ธ Forensic Investigation: If SMS are needed for court, their extraction must be carried out by certified specialists in compliance with the chain of evidence.
- ๐ Corporate devices: On work phones, access to SMS may be regulated by company policy (for example, through MDM solutions).
If you are developing an application that works with SMS, required:
- ๐ Specify permission AndroidManifest.xml permission
android.permission.READ_SMS. - ๐ Request explicit consent from the user to access messages.
- ๐ซ Do not store SMS on your servers without encryption and consent user.
Since 2023 Google Play tightened the rules for applications that work with SMS. Now confirmation of the legitimacy of using the permission is required for publication READ_SMS (for example, for backup or two-factor authentication).
If you are retrieving SMS for personal use (for example, to save important correspondence), make sure that:
- ๐ฑ The device belongs to you or you have the permission of the owner.
- ๐ The data will not be used for surveillance or blackmail.
- ๐๏ธ After extraction, you will delete temporary copies of the database.
7. Alternative ways to store SMS: clouds and instant messengers
Many users do not know that their SMS can be automatically synchronized with cloud services. This simplifies backup, but creates privacy risks.
Where else can your SMS be stored:
- โ๏ธ Google Messages: If you use the standard application Messages from Google, correspondence can be synchronized with messages.google.com. Available only for devices with Android 8+.
- โ๏ธ Samsung Cloud: On devices Samsung SMS backups are created automatically (if synchronization is enabled).
- โ๏ธ iCloud (for those switching from iPhone): When transferring data from iPhone to Android via Move to iOS SMS can be temporarily stored in iCloud.
- ๐ฑ Third-party messengers: Applications like WhatsApp or Telegram do not store SMS, but may contain copies of them if you forwarded messages to chats.
To check if your SMS are synchronized with Google:
- Open messages.google.com in the browser.
- Log in under the same account Googleas on the phone.
- If the correspondence is displayed, synchronization is enabled.
To disable SMS synchronization in Google Messages:
- Open the application Messages.
- Go to
Settings โ Backup and reset. - Disable the option
Message backup.
If you use Google Fi (mobile communication service from Google), your SMS can be stored on the companyโs servers even after being deleted from the phone. To delete them completely, visit fi.google.com and clear the history.
FAQ: Frequently asked questions about storing SMS in Android
Is it possible to read SMS from someone else's phone without root?
Technically yes, but to do this you need to physically connect to the device with USB debugging is enabled and obtain the owner's permission (via confirmation on the phone screen). Without the consent of the owner, such actions violate the law on confidentiality of correspondence. Also, many manufacturers (for example, Xiaomi or Huawei) block adb backup, making retrieving SMS without root impossible.
Where are SMS stored in Android 13 and newer?
B Android 13+ the path to the database remains the same: /data/user_de/0/com.android.providers.telephony/databases/telephony.db. However, due to stricter privacy policies, access to the file without root has become even more complicated. Google recommends using SMS Retriever API for legitimate access to messages in applications.
How to transfer SMS from one Android phone to another?
The most reliable methods:
- Use SMS Backup & Restore (export on one phone, import on another).
- For devices Samsung โuse Smart Switch.
- If both phones are connected to the same account Google, enable synchronization in Google Messages.
Transfer via copying telephony.db is only possible with rootrights on both devices.
Is it possible to restore SMS after resetting the phone to factory settings?
If a backup was not created before the reset (locally or in the cloud), the chances of recovery are close to zero. Resetting to factory settings completely clears the partition /datawhere the SMS database is stored. The exception is if the device was connected to Google Messages with synchronization enabled: in this case, the correspondence may be saved on the servers Google.
Why some SMS are not displayed in the database telephony.db?
This can happen for several reasons:
- Messages sent/received via RCS (for example, in Google Messages) and are stored separately.
- Third-party messengers (for example, WhatsApp or Viber) do not save SMS to the standard database.
- The manufacturer has modified Android and uses alternative storage (for example, Huawei in some firmware).
- The messages have been deleted and have not yet been overwritten in the database (you can try to restore them from
root).