Creating a local SQLite database
SQLite databases are a fantastic way to store structured information from a web context. SQLite is a self-contained transactional database that does not require any configuration. It is ideal for saving and querying dynamic information within a mobile application.
How to do it...
In this recipe, we will create a mobile application that will allow us to store text entries in a local SQLite database, and then query the database to retrieve all saved items:
- Firstly, create a new PhoneGap project named
sqlite
by running the following line:phonegap create sqlite com.myapp.sqlite sqlite
- Add the devices platform. You can choose to use Android, iOS, or both:
cordova platform add ios cordova platform add android
- Open
www/index.html
and clean up the unnecessary elements. So, this is what you will have:<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="format-detection" content="telephone...