Can't access pre populated SQLite database using PhoneGap/Cordova in Android

前端 未结 3 811
面向向阳花
面向向阳花 2020-12-20 09:58

We are trying to create a mobile app using PhoneGap/Cordova. We need to ship this app with a pre-populated SQLite db. We are able to copy the DB using below code. But when w

3条回答
  •  攒了一身酷
    2020-12-20 10:34

    To access pre-populated database you should first copy the database file in www directory.

    Install this plugin DB-Copy plugin and copy the database from www directory into the device, using the copy plugin and then use Sqlite-storage plugin to access the database.

    PS. The copy of database from www directory is need it because each OS has different location to store databases...

提交回复
热议问题