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
Move to the directory you just created:
$ cd DeviceApi
Add the platforms you want to test on the device API. For this example, we add the Android platform:
$ cordova platform add android
Delete all the files and subdirectories except
index.html
inside thewww
directory. Open theindex.html
file you will find in thewww
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/>...
PhoneGap Beginners Guide (third edition)
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
Free Chapter
Introduction to PhoneGap
Building Your First PhoneGap Project
Mobile Frameworks
Working with Plugins
Using Device Storage and the Files API
Using the Contacts and Camera APIs
Accessing the Device Sensors and Locations API
Advanced PhoneGap
Getting Ready for Release
A Sample PhoneGap Project
The JavaScript Quick Cheat Sheet
Publishing Your App
Related Plugin Resources
PhoneGap Tools
Index
Customer Reviews