Book Image

PhoneGap Beginners Guide (third edition)

Book Image

PhoneGap Beginners Guide (third edition)

Overview of this book

Table of Contents (22 chapters)
PhoneGap Beginner's Guide Third Edition
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Related Plugin Resources
Index

Time for action – reading and writing data on the LocalStorage


  1. Open the command-line tool and create a new PhoneGap project using the PhoneGap CLI you installed before. This will create a new directory called DeviceApi in your current working directory; this can be done using the following command:

    $ phonegap create DeviceApi
    
  2. Move to the directory you just created:

    $ cd DeviceApi
    
  3. Add the platforms you want to test on the device API. For this example, we add the Android platform:

    $ cordova platform add android
    
  4. Delete all the files and subdirectories except index.html inside the www directory. Open the index.html file you will find in the www root folder and add the following HTML code snippet:

    <button type="button" onclick="addCountry()">Add Canada</button> <br/><br/>
    <button type="button" onclick="get1Data()">Get USA Data</button> <br/><br/>
    <button type="button" onclick="getAllData()">Get All Data</button> <br/><br/&gt...