Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get SQLite database from Android app

Tags:

android

sqlite

I need get SQLite database from Android app from Genesis device where user has populated by hand.

How I can create another app or any other way to get this db and save in place where I can get?

obs.: the device has root

Thanks

like image 704
Paulo Kussler Avatar asked Jan 11 '14 12:01

Paulo Kussler


People also ask

How save and retrieve data from SQLite database in Android?

We can retrieve anything from database using an object of the Cursor class. We will call a method of this class called rawQuery and it will return a resultset with the cursor pointing to the table. We can move the cursor forward and retrieve the data. This method return the total number of columns of the table.

Where is SQLite database stored in Android emulator?

The databases are stored as SQLite files in /data/data/PACKAGE/databases/DATABASEFILE where: PACKAGE is the package declared in the AndroidManifest.


2 Answers

Steps from .../platform-tools of Android on cmd:

1) type adb shell

2) run-as com.your.package

3) type ls

cache

databases

lib

You can find Your Database Here...Also You didn't even have to root the Device

Hope this could helpful for you...

like image 173
Nitesh Tiwari Avatar answered Sep 24 '22 13:09

Nitesh Tiwari


Provided you have the device attached to a box with adb on the PATH you can use this command:

adb -d shell 'run-as your.package.name.here cat /data/data/your.package.name.here/databases/your_db_name_here.sqlite > /sdcard/recovered_db.sqlite'

Or you can use Ecliplse DDMS file explorer.

like image 40
elbuild Avatar answered Sep 21 '22 13:09

elbuild