Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Ionic: How to Access or Browse SQLite Database

DZone's Guide to

Ionic: How to Access or Browse SQLite Database

The article has instructions on how you can access or browse SQLite database embedded in your android app.

· Mobile Zone
Free Resource

Download this comprehensive Mobile Testing Reference Guide to help prioritize which mobile devices and OSs to test against, brought to you in partnership with Sauce Labs.

The article has instructions on how you can access or browse SQLite database embedded in your android app. The way that works for me is to copy the database onto my system and access the same.

Make sure you have connected your mobile phone to your laptop/desktop. Check with command “adb devices” to see that your device (phone) is listed.

The following commands can be used to get the Cordova SQLite database on your hard disk filesystem:

  • adb shell
  • run-as package-name-of-the-app
  • chmod 666 databases/database_name
  • exit
  • cp /data/data/package-name-of-app/databases/database_name /sdcard/
  • run-as package-name-of-the-app
  • chmod 600 databases/database_name
  • exit; exit

Once you are on system command prompt, execute the following command to copy the database file to current directory:

adb pull /sdcard/database_name 


With the above command, you should be able to find the database copied in the current directory.

Use SQLite browser to open the database and browse the data.

That is it!

Analysts agree that a mix of emulators/simulators and real devices are necessary to optimize your mobile app testing - learn more in this white paper, brought to you in partnership with Sauce Labs.

Topics:
app ,android ,command ,database ,browser ,android app ,cordova ,adb ,sqlite

Published at DZone with permission of Ajitesh Kumar, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}