Here is How to See SQLite Database Data Saved in Device using Android Studio. This post has the steps to see the data stored in the SQLite database in the device. This is an extended post of our previous post Example of SQLite Database in React Native and Example to Load Pre Populated SQLite Database in React Native.
There are lots of confusions in people related to How to see the SQLite database? and that is the main reason behind writing this post. While developing the application wither we provide the pre-populated database or make the database at runtime but in both cases, we can not see the database of the device directly.
If we talk about the database that we make in runtime then we can understand that but most of the people get confused in the second case when we use the pre-populated database. In the second case, they provide the database from as a reference in the asset /www directory and that database will be used by the application and after modifying the data in the database they look for the change in the same database which is confusion point.
So let me clear that. When you are providing the database while developing the application, app builder takes the database from the reference location and copy it to the APK and after deploying that APK into the device the database will be managed in the device only so the database that you have provided on your PC/laptop is just for the starting, it is not the same database that device modifies.
Hope you got my point. Now the question comes in everybody’s mind is How to See SQLite Database Data Saved in Device. So here are the steps to see the SQLite database of the app installed in a particular device:
Note: You can only see the database of the debug app, not of the release app.
Open SQLite Database Stored in Device using Android Studio
1. If you are working with the Real Device or with the emulator you can connect it with the Android Studio just by opening the project with Android Studio. For that, you have to open the Android Studio and in File > Open > Find your project in the directory and open the <Your project>/android directory.
2. Now run the project on your device.
3. Add or modify some data in the app.
4. Keep your device connected with Android Studio and find the “Device File Explorer” which you can find in the right bottom of the Android Studio. Now Click on that.
If you are unable to find the Device File Explorer then try to find View option in the top menu and hover over “Tool Windows”. Here you will see “Device File Explorer” option just click on it.
5. You will see a window will open and now select the device from the top and expand the data option.
6. Find the package name of your application in the list.
7. Expand the application package directory and expand the database directory under that. You can see the database you have made or provided. Now right-click onto that and you will see the Save As option.
8. Please save the database on a known location. (This process is like downloading the database from the mobile application to your PC/Laptop)
9. Now Open DB Browser for SQLite. you can download this from here. If this is not supported for your OS then you can choose any of the SQLite Database viewers.
10. Now Open the database using File > Open Database> and by choosing the file you have saved on your PC/Laptop.
This is how you can See SQLite Database Data Saved in Device using Android Studio. If you have any doubt or you want to share something about the topic you can comment below or contact us here. There will be more posts coming soon. Stay tuned!
Hope you liked it. 🙂