2

Hi all, I am aware how to use sqlite3 on emulator to monitor data of app. Is it possible to use on a real device?
My device is Nexus S when I try on my device it says sqlite3 is not found. Is it compulsory to sqlite 3 device must be a rooted one? My device is not a rooted device.

I am aware of other mechanism of looking data for example dump db file in SD card then use third party SQL browser to look into the data.

joao2fast4u
  • 6,868
  • 5
  • 28
  • 42
CodingRat
  • 1,934
  • 3
  • 23
  • 43
  • Please, clarify what you are asking. Of course, you can use SQLite dbs on non rooted devices. You wouldn't be even able to read and save your contacts, otherwise (since a SQLite db is used for contacts). – Phantômaxx Apr 11 '14 at 11:24
  • Yes you can use sqlite without root permission.As i understand your question there is no sqlite file in assets folder – Ammar ali Apr 11 '14 at 11:40

2 Answers2

2

U cant use Sqlite3 instead u can do this. The following solution works only for apps that are debuggable. It may not work well on all devices, since ​​run-as command doesn't work on some devices, especially with Jelly Bean.

  1. ​Create a *.bat or a *.sh file and copy the following scripts ​​

    adb shell run-as [package] chmod 777 /data/data/[package]/databases/

    adb shell run-as [package] chmod 777 data/data/[package]/databases/[db_file_name]

    adb shell cp /data/data/[package]/databases/[db_file_name] /sdcard/

    adb pull /sdcard/[db_file_name]

  2. ​Change [package] to the desired application package

  3. Change [db_file_name] to the desired db name Run the bat file and you should see the copied database in the same folder as the bat file

Gowtham Raj
  • 2,915
  • 1
  • 24
  • 38
1

If you're asking about using sqlite3 on shell (terminal), then no -- first you can't access the databases folder in your app because of permissions. second there's probably no sqlite3 installed in your non-rooted phone.

lucky enough, your nexus s, being a nexus device, is one of the easiest devices to root. there's even a tool created to root any nexus device - get it here.

After rooting, follow instructions on the third post here to install sqlite.

Community
  • 1
  • 1
josephus
  • 8,284
  • 1
  • 37
  • 57
  • Actually no need to root, if the app is debuggable. See http://stackoverflow.com/a/23387205/1180898 - but the second part is correct (no sqlite on device) - but you can edit/query/whatever on a pc and push it back – Amir Uval Apr 30 '14 at 12:54