I have a SQLite Database on my Android Device (My own App). Now i want to see the SQLite Database on my Computer.
Is there any solution ( easy way ) to get the Database without root rights and without a SD-Card on my Computer?
I tried to google it but i can't find any solution for this problem....
Edit: I'm using not the Emulator ( need the Camera on my Device).
if phone is not rooted you cant access directly your DB, but you can copy it to download folder, then, copy to PC
public static void copyAppDbToDownloadFolder(Activity ctx) throws IOException {
File backupDB = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS),
"databse_name.db"); // for example "my_data_backup.db"
File currentDB = getApplicationContext().getDatabasePath("databasename.db");
if (currentDB.exists()) {
FileChannel src = new FileInputStream(currentDB).getChannel();
FileChannel dst = new FileOutputStream(backupDB).getChannel();
dst.transferFrom(src, 0, src.size());
src.close();
dst.close();
}
}
This method worked for my unrooted device.
# check if your device connected
adb devices
adb shell
run-as your.package.name
chmod 777 databases/your.database.name
exit
cp /data/data/your.package.name/your.database.name /mnt/sdcard/
exit
adb pull /mnt/sdcard/your.database.name
If you are saving Sqlite DB in default location , you can find the same in path like following
/data/data/com.dev.myapplication/databases/mydb.db
You can find the same using Android Device Monitor, through which you can navigate to both internal and external memory.
Once you find the database file, extract the same and save in desktop after connecting through USB cable. You can use option "Pull a file from device"
Once you have extracted file to desktop, use any tools similar to Mozilla Firefox SQLite viewer to view database.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With