Copy your Akavache database from your Android phone

Akavache is an awesome library to use when it comes to caching. It's fast, cross platform and it abstracts the complexity of working correctly and fast with sqlite.

Sometimes you need to verify the exact data that is stored. You can write some code in your app to read the data and show it on your screen, but on Android there is a faster way. You can copy the database to your computer.

Search the database location

Open an Android SDK prompt (in Xamarin Studio Tools > Open Android SDK Command Prompt...). Open a shell to your device and look for the database. Normally you can find the database "blobs.db" in the folder "cache".

adb shell  
run-as your.package.name  
# ex: com.devprotocol.xam.mobiledemo
cd cache  
ls  

If you have 3 blobs files (blobs.db, blobs.db-shm and blobs.db-wal) you'll need to copy them all to get all the data.

Now that we know where we can find the database, we can exit the shell

If you are still in the shell, exit the shell

shell@bullhead:/data/data/your.package.name $ exit  
shell@bullhead:/ $ exit  

Copy your Akavache database

Now in the Android command prompt copy the file to the sdcard of the device

adb -d shell "run-as your.package.name cp cache/blobs.db /sdcard"  

Copy the file to your computer. The following command will copy the blobs.db file from the sdcard of your Android device to the temp folder in your home directory if you're working with a mac (if you're working with a PC change the path accordingly)

adb pull /sdcard/blobs.db ~/temp  

Explore your database

You can now start exploring the database with a the Akavache explorer or another sqlite tool.


info: