Book Image

PhoneGap 4 Mobile Application Development Cookbook

Book Image

PhoneGap 4 Mobile Application Development Cookbook

Overview of this book

Table of Contents (19 chapters)
PhoneGap 4 Mobile Application Development Cookbook
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
Index

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:

  1. Firstly, create a new PhoneGap project named sqlite by running the following line:

    phonegap create sqlite com.myapp.sqlite sqlite
    
  2. Add the devices platform. You can choose to use Android, iOS, or both:

    cordova platform add ios
    cordova platform add android
    
  3. 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=no" />
          ...