Often, when writing Android apps that store data in an SQLite database, I need to view the contents of that database to see if data was stored properly, etc.
With my current project, the schema needs to be fairly complex, and, at one point, I had to check up on what the database contained every few seconds.
To make things easier, I chained together a few things with duct tape, chewing gum, and adb. I do my Android dev on a Mac, but you shouldn’t have much trouble adapting this little automation to other platforms.
Download Navicat Lite. I’m not sure if Navicat still offers this download directly, but you can still find copies of it floating around the web. If you have a copy of Navicat Premium, that should work as well.
When installed, Navicat should associate itself as the default app to handle .sqlite files.
Create a new shell script file, say, opendb.sh, with the following contents:
Replace com.company.app, with the package name of your Android app.
Replace appdbname with the name of your SQLite database.
It would make things easier if your adb binary is in your PATH. If it isn’t, use the full path to adb in the script.
Your Android simulator should already be running, or your device already connected, for the adb pull to work.
Run chmod +x opendb.sh to make the script executable.
With that done, now, every time you need to take a quick look at the contents of the SQLite database for your app, just run this script. The database file will be pulled from the device/simulator, and automatically opened with Navicat.