Search code examples
androidiossqlitecordovaphonegap-plugins

how to populate a SQLite database and use that database in phonegap?


so I'm new in Phonegap and I want to populate a database and use that database in my code. I want to know how can I do that but I don't know witch tool to use for populate a Sqlite database and how to open that database in my code. I've seen the sqlitePlugin and ioliteHelpers plugin but because of very short document I don't know how to use them exactly. besides i have seen this question too, but it don't have answers. thanks in advance.


Solution

  • Though this question is old... thought it might help someone to post my solution - found in 2017. (Since PhoneGap has changed, older solutions may no longer work or be accepted on the Android and Apple app markets.) I worked on this problem for a long time - the issue about how to import a pre-populated database - which there are not alot of easy solutions for. I found the best - and currently just about the ONLY - solution to be LiteHelpers CORDOVA-SQLITE-EXT (https://github.com/litehelpers/cordova-sqlite-ext)

    I have added this in to my app and it is working well. I had to switch away from PhoneGap though - and use CORDOVA - but it is working for me.

    Re: your problem of how to pre-populate your SQLite database - there are many options - and it depends where your data is sitting now. I have been able to convert most of the main data storage types in to SQLite. If this issue is still something you need an answer for, then please tell us where your data is sitting now - what format?