How to Install SQLIte Plugin in Android + iOS in Phonegap

孤人 提交于 2019-12-21 22:40:28

问题


I am building mobile app using phonegap and am using Phonegap 2.9.0 version and SQLite Plugin from the https://github.com/pgsqlite/PG-SQLitePlugin-Android.

I have include below js file in index.html,

<script type="text/javascript" charset="utf-8" src="cordova.js"></script> <script type="text/javascript" charset="utf-8" src="SQLitePlugin.js"></script>

then calling below method in deviceready event,

var db = window.sqlitePlugin.openDatabase("test.db", "1.0", "test", 20000);

I have also copy the test.db Database to this folder "/data/data/"+pName+"/databases/".

I have followed exact steps given in above site but dont know something still missing and SQLite Plugin not working.

Please help me and if anyone have example then its better for me to understand.

Regards


回答1:


Please change your code line to

var db = window.openDatabase("test.db", "1.0", "test", 20000);

instead of

var db = window.sqlitePlugin.openDatabase("test.db", "1.0", "test", 20000);


来源:https://stackoverflow.com/questions/17653809/how-to-install-sqlite-plugin-in-android-ios-in-phonegap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!