如何在Phonegap中的Android + iOS中安装SQLIte插件 [英] How to Install SQLIte Plugin in Android + iOS in Phonegap

查看:71
本文介绍了如何在Phonegap中的Android + iOS中安装SQLIte插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用phonegap构建移动应用程序,并且正在使用 https://github.com/pgsqlite/PG-SQLitePlugin-Android .

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.

我在index.html中包含了以下js文件,

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>

然后在deviceready事件中调用以下方法,

then calling below method in deviceready event,

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

我还将test.db数据库复制到此文件夹"/data/data/" + pName +"/databases/".

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

我已经按照上面网站中给出的确切步骤进行操作,但是不知道仍然缺少某些内容并且SQLite插件无法正常工作.

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.

致谢

推荐答案

请将您的代码行更改为

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

代替

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

这篇关于如何在Phonegap中的Android + iOS中安装SQLIte插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆