Here I am going to move one step ahead for Android Phonegap application article Series.Last what we have seen is To restrict screen orientation in Android.In this article, I am going to explain how to setup SQLite Cordova for Android application.
SQLite is an Open Source Database which is embedded into Android. SQLite supports standard relational database features like SQL syntax, transactions and prepared statements. Moreover, SQLite requires very less memory at runtime.
Must Read: Getting Started With PhoneGap
So, You can download SQLite Cordova plugin from here.Now, Let’s see how to install plugin for android application.
First of all, add required js into your js folder of assets and js are SQLite.js,qunit-1.5.0.js and SQLite.coffee files.
Next,Add your plugin file of SQLite into src folder.
Go to XML folder and open config.XML and place below line of code:
1 2 3 | <plugin name="SQLitePlugin" value="com.phonegap.plugin.sqlite"> |
That’s it.You are done with SQLite plugin installation in Android application.
Now, It’s time to connect with SQLite database, so here is the syntax to connect with database.
1 2 3 | db=window.sqlitePlugin.openDatabase({name:”name_of_db”}); |
Read: Solution: Header moves using jQuery mobile and Phonegap in Android
You can check your SQLite database into DDMS >> file explore >> data >> data >> project package >> databases >> FILENAME.
You can use SQLite Cordova plugin and code for both android and iOS application.
In next article, we will see Basic Query and connection of SQLite database. I’m hoping that you’ve found this article helpful.
As always, thanks for reading. Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.
Comments (8)