Reputation: 3556
So I was reading quite a lot, but still don't understand how to do it. In the location where app database suppose to be located there is three files instead of one .db
it has now .db
.db-shm
and .db-wal
so how do I export this database as one file with all its data? Because as far as I understand now all data is located in file .db-wal
.
So far I tried to close all connections to database before exporting because in SQL documentation it says that it .db-wal
will be merged, but still same scenario
Upvotes: 2
Views: 831
Reputation: 2645
This is how I do it (on an ubuntu machine):
Run the following code, to pull Sqlite database from app to SD card:
./adb -d shell "run-as com.example.name.myappname cp /data/data/com.example.name.myappname /databases/database.db /sdcard/database.db"
*Make sure to replace "database.db" and "com.example.name.myappname", by your databasename and app name (found in your manifest).
Run the following code, to pull the Sqlite data from SD card to desktop:
./adb -d pull /sdcard/database.db ~/Desktop/database.db
If you want to load your app with this database, I recommend using SQLiteAssetHelper.
Upvotes: 1