O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

PhoneGap : Beginner's Guide - Third Edition

Book Description

Create, develop, debug, and deploy your very own mobile applications with PhoneGap

In Detail

Given the increase in usage of mobile devices, mobile app development is in huge demand. This book provides you with the skills you need to successfully create, develop, debug, and deploy a cross-platform mobile application with PhoneGap 5. The book starts with the basics of PhoneGap, covering setting up your development environment, creating a simple project, and debugging and deploying it to your mobile devices. By sequentially working through the sections in each chapter, you will quickly get to know about the available features of various mobile frameworks and the various PhoneGap plugins you can utilize to create your apps. You will then learn how to build a hybrid application using PhoneGap. Finally, by the end of the book, you will be able to implement the most common features of modern mobile apps and build rich, native-style applications.

What You Will Learn

  • Get acquainted with the fundamentals of PhoneGap
  • Use HTML, CSS, and JavaScript to create, debug, and deploy your own mobile applications
  • Work with mobile-specific frameworks such as iOS and Android to design your applications
  • Install and work with all PhoneGap/Cordova plugins
  • Implement device-oriented APIs related to contacts, files, the camera, and geolocations
  • Use PhoneGap/Cordova events for accessibility
  • Enhance and optimize your application for real-time environments

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. PhoneGap Beginner's Guide Third Edition
    1. Table of Contents
    2. PhoneGap Beginner's Guide Third Edition
    3. Credits
    4. Foreword
    5. About the Authors
    6. About the Reviewers
    7. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    8. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Sections
      5. Time for action – heading
        1. What just happened?
        2. Pop quiz – heading
        3. Have a go hero – heading
      6. Conventions
      7. Reader feedback
      8. Customer support
        1. Errata
        2. Piracy
        3. Questions
    9. 1. Introduction to PhoneGap
      1. About PhoneGap
      2. PhoneGap and Apache Cordova
        1. The evolution of PhoneGap and Cordova
      3. Choosing an operating system for development
      4. Mobile web versus mobile app
      5. Installing dependencies
        1. Java JDK
        2. Apache Ant
      6. Installing PhoneGap
      7. Setting up your development environment
      8. Time for action – setting up Android using PhoneGap 3.x
        1. What just happened?
        2. Working with other platforms
      9. Getting started with Android and JBoss
      10. Time for action – using JBoss Developer Studio
        1. What just happened?
      11. Getting started with iOS and Xcode
      12. Getting started with Windows Phone and Visual Studio
      13. Summary
    10. 2. Building Your First PhoneGap Project
      1. The structure of a PhoneGap application
      2. Using the PhoneGap CLI
      3. Cordova events
        1. The deviceready event
        2. The online event
        3. The offline event
        4. The pause event
        5. The resume event
        6. The backbutton event
      4. Time for action – the Hello World example
        1. What just happened?
      5. WebKit debugging – Chrome, Safari, and Opera
      6. Gecko debugging – Firefox
      7. Internet Explorer
      8. Debugging workflow
      9. Building and deployment
      10. Summary
    11. 3. Mobile Frameworks
      1. Building native UI for the mobile
        1. The viewport meta tag
        2. Unwanted telephone number linking
        3. Autocorrect
        4. CSS media queries and mobile properties
        5. Screen orientation
        6. Device orientation
        7. Shake gestures
        8. Media capture APIs
        9. Data URI
      2. Achieving a native look and feel on iOS
      3. Choosing mobile frameworks
        1. Using HTML5 Mobile Boilerplate
        2. Using Zurb Foundation
        3. Using Twitter Bootstrap
        4. Ionic framework
        5. ExtJS
        6. AngularJS
        7. jQuery Mobile
      4. Time for action – developing with jQuery Mobile
      5. Selecting a framework
      6. Summary
    12. 4. Working with Plugins
      1. An introduction to plugins
        1. Getting started with plugins
          1. Installing plugins
            1. Listing installed plugins
          2. Removing plugins
        2. Using plugins with Plugman
      2. Exploring the Device API
      3. Time for action – accessing the Device API
        1. What just happened?
      4. Custom plugins
      5. Summary
    13. 5. Using Device Storage and the Files API
      1. Application data storage
        1. Exploring the PhoneGap LocalStorage API
      2. Time for action – reading and writing data on the LocalStorage
        1. What just happened?
        2. Exploring the PhoneGap SQL storage
        3. Working with database storage in PhoneGap
      3. Time for action – populating a local database
        1. What just happened?
      4. Database limitations
      5. Understanding the Files API
        1. Reading directories and files
      6. Time for action – listing folders
        1. What just happened?
        2. Writing and reading a file's data
      7. Time for action – reading and rendering an image
        1. What just happened?
        2. Transferring files
      8. Time for action – downloading and saving a file
        1. What just happened?
      9. Summary
    14. 6. Using the Contacts and Camera APIs
      1. The Contacts API
        1. The ContactName object
        2. The ContactField object
        3. The ContactAddress object
        4. The ContactOrganization object
        5. The Contact object
        6. Filtering contact data
      2. Time for action – searching device contacts
        1. What just happened?
      3. Time for action – adding a new contact
        1. What just happened?
      4. Camera API or Capture API?
      5. Accessing the camera using the Camera API
      6. Time for action – accessing the device camera
        1. What just happened?
        2. Controlling the camera popover
      7. Time for action – controlling the position of the camera roll
        1. What just happened?
      8. The Media Capture API
      9. Time for action – manipulating images with a canvas
      10. Summary
    15. 7. Accessing the Device Sensors and Locations API
      1. Introducing device sensors
        1. Sensors and human-computer interaction
      2. Accelerometer
        1. Detecting shakes
        2. Device orientation events
        3. Handling orientation with JavaScript
      3. Time for action – handling device orientation with JavaScript
        1. What just happened?
      4. Compass
        1. Creating a compass
      5. Time for action – using the Compass API
        1. What just happened?
      6. An introduction to geolocation
      7. The PhoneGap Geolocation API
      8. Time for action – showing device position with Google Maps
        1. What just happened?
        2. Other geolocation data
      9. Summary
    16. 8. Advanced PhoneGap
      1. Using the Globalization API
      2. Localizing your app
      3. Time for action – rendering localized messages
        1. What just happened?
      4. Adding multitouch gesture support
      5. Time for action – implementing gesture support
      6. Handling click delays
      7. Summary
    17. 9. Getting Ready for Release
      1. Exploring JavaScript compression
        1. Google Closure Compiler
      2. Time for action – compressing files using the Closure Compiler
        1. What just happened?
        2. UglifyJS2
      3. Time for action – using UglifyJS
        1. What just happened?
        2. Optimization with RequireJS
      4. Time for action – optimizing JavaScript with RequireJS
        1. What just happened?
      5. Comparing compression tools
      6. Using template engine compression
      7. Time for action – compiling a template using Pistachio
        1. What just happened?
      8. Creating fluid, multiple app views
      9. Using hardware-accelerated transitions
        1. AliceJS
      10. Porting web applications
      11. Summary
    18. 10. A Sample PhoneGap Project
      1. What's in the app?
        1. Libraries used
          1. Twitter Bootstrap
          2. jQuery
          3. mMenu
          4. FastClick
      2. Creating the project
        1. Installing plugins
        2. Design of the homepage
        3. Using the Accelerometer API
        4. Using the Device API
        5. Using the Camera API
        6. Using the Capture API
        7. Using the Connection API
        8. Using the Contacts API
        9. Using the Files API
        10. Using the Globalization API
        11. Using the InApp Browser API
        12. Using the Notification API
        13. Using the Splash Screen API
        14. Using the GeoLocation API
        15. Building the app
      3. Scope for improvements
      4. Summary
    19. A. The JavaScript Quick Cheat Sheet
      1. The getElementById() method
      2. The getElementsByTagName() method
      3. The getElementsByName() method
      4. The alert method
      5. The toString() method
      6. The parseInt() method
      7. The getDate() method
      8. The onclick event
      9. The ondblclick event
      10. The window.location object
      11. Selectors using jQuery
    20. B. Publishing Your App
      1. Publishing on Google Play
      2. Publishing on Blackberry World
      3. Publishing on the Apple App Store
      4. Publishing on the Windows Phone Store
      5. Summary
    21. C. Related Plugin Resources
      1. Summary
    22. D. PhoneGap Tools
      1. The PhoneGap Developer App
      2. The PhoneGap Desktop App
      3. Summary
    23. Index