Search code examples
androidandroid-room

Does Android Room database not safe data in the files?


I have an app, where I use Android Room Database. One thing I have noticed is, that database files get created in /data/{app_name}/databases, which I can see within the Device File Explorer in Android Studio, but when I insert data into the database through the app, the files don't change.

The inserted data is correctly shown in the Database Inspector in Android Studio and within the app, but I can't find the inserted data in the files. Even after synchronizing the Device File Explorer.

The data still exists and is correctly shown in the Database Inspector and the app after closing the app and restarting it, so it has to be saved somewhere.

Where is the data saved, if not in the database files? And why are the files created, if they are seemingly not used?


Solution

  • There is wal file in the directory with the database. The data is there.

    Read more about SQLite Write-Ahead Logging