I have an sqlite database test_db.db i have kept in the www folder i am using cordova cli to build android app on my local machine.
when i am trying to open the data
To open prepopulated db in cordova project, you need to do 3 steps:
Copy .db file into main www directory
Install this plugin and use copy method(this will copy the .db file to the specified directory for your os/device)
Use this plugin to open the .db file
Thats it... :)
Hello I got the solution for this question.
while opening the database in the folling code
var db = window.sqlitePlugin.openDatabase({ name : "test_db.db" });
Add a parameter like this
var db = window.sqlitePlugin.openDatabase({ name : "test_db.db", createFromLocation : 1 });
Then it will take the database which you have kept in the www folder.