You are previewing PhoneGap 4 Mobile Application Development Cookbook.
O'Reilly logo
PhoneGap 4 Mobile Application Development Cookbook

Book Description

Build real-world hybrid mobile applications using the robust PhoneGap development platform

About This Book

  • Get to grips with the usage of PhoneGap and its command-line interface

  • Learn to use numerous plugins to access several hardware capabilities

  • Step-by-step instructions on creating captivating mobile applications using popular frameworks

  • Who This Book Is For

    If you are a developer who wants to get started with mobile application development using PhoneGap, then this book is for you. Previous experience with data mining libraries will help, but is not mandatory. A basic understanding of web technologies such as HTML, CSS, and JavaScript is a must.

    What You Will Learn

  • Set up a development environment to develop PhoneGap applications

  • Generate, build, and run applications using the PhoneGap command-line interface

  • Install plugins from the command line to add native capabilities to your application

  • Call the JavaScript API of plugins and hook into native events

  • Manipulate DOM using zepto and xuijs

  • Develop a user interface using jQuery Mobile and the Ionic framework

  • Get accustomed to using the PhoneGap Build service

  • In Detail

    Developing mobile applications often feels intimidating. Especially when building cross-platform application. We have to learn a specific programming language to build an application for each platform. PhoneGap makes cross-platform mobile application development faster and easier by using web technologies such as HTML5, CSS, and JavaScript.

    This book gives you practical lessons on how to build a world class mobile application using PhoneGap. Whether you are a brand new to mobile application development, a web developer expert, or a seasoned mobile application developer, this book will guide you through creating hybrid mobile applications.

    Starting with setting up a development environment, the book moves on to utilizing a new PhoneGap command-line tool, installing plugins, and designing your application. It then moves on to concepts such as file system, storage, and local database, the book effectively lays a solid base for advanced topics.

    By working through the steps in each chapter, you will quickly master the features of PhoneGap. By the end of the book, you will be able to successfully build a highly functional, real-world hybrid mobile application using PhoneGap.

    Style and approach

    And easy-to-follow guide full of practical examples of real-world mobile application. Each topic is explained step by step with detailed explanations on each concept.

    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 code file.

    Table of Contents

    1. PhoneGap 4 Mobile Application Development Cookbook
      1. Table of Contents
      2. PhoneGap 4 Mobile Application Development Cookbook
      3. Credits
      4. About the Authors
      5. About the Reviewer
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Sections
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Conventions
        6. Reader feedback
        7. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Welcome to PhoneGap 3
        1. Introduction
        2. Installing PhoneGap 3
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        3. Creating a new project
          1. How to do it…
          2. How it works…
        4. Using the command line
          1. How to do it…
            1. The local commands
            2. The remote commands
          2. How it works…
        5. Installing API plugins
          1. How to do it…
            1. Adding plugins
            2. Listing plugins
            3. Removing plugins
          2. How it works…
          3. See also
      9. 2. Movement and Location – Using the Accelerometer and Geolocation Sensors
        1. Introduction
        2. Detecting device movement using the accelerometer
          1. How to do it…
          2. How it works…
          3. There's more...
          4. See also
        3. Adjusting the accelerometer sensor update interval
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also…
        4. Updating a display object position through accelerometer events
          1. How to do it…
          2. How it works…
        5. Obtaining device geolocation sensor information
          1. How to do it…
          2. How it works…
          3. There's more...
          4. See also
        6. Adjusting the geolocation sensor update interval
          1. How to do it…
          2. How it works…
          3. There's more…
            1. Clearing the interval
        7. Retrieving map data through geolocation coordinates
          1. Getting ready
          2. How to do it…
          3. How it works...
            1. Static maps
          4. There's more…
          5. See also
        8. Creating a visual compass to show the device direction
          1. How to do it…
          2. How it works…
          3. See also
      10. 3. Filesystems, Storage, and Local Databases
        1. Introduction
        2. Saving a file in the device storage
          1. How to do it...
          2. How it works…
          3. There's more…
            1. Domain whitelist
          4. See also
        3. Opening a local file from the device storage
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        4. Displaying the contents of a directory
          1. How to do it...
          2. How it works…
          3. See also
        5. Creating a local SQLite database
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        6. Uploading a file on a remote server
          1. How to do it...
          2. How it works...
          3. See also
        7. Caching content using the local storage API
          1. How to do it...
          2. How it works...
            1. Lawnchair
      11. 4. Working with Audio, Images, and Video
        1. Introduction
        2. Capturing audio using the device audio recording application
          1. How to do it...
          2. How it works…
          3. See also
        3. Recording audio within your application
          1. How to do it...
          2. How it works...
          3. See also
        4. Playing audio files from the local filesystem or over HTTP
          1. How to do it...
          2. How it works...
          3. There's more...
        5. Capturing a video using the device video recording application
          1. How to do it...
          2. How it works...
        6. Loading a photograph from the device camera roll/library
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        7. Applying an effect to an image using canvas
          1. How to do it...
          2. How it works...
          3. There's more...
        8. Playing a remote video
          1. How to do it...
          2. How it works...
      12. 5. Working with Your Contacts List
        1. Introduction
        2. Listing all available contacts
          1. How to do it...
          2. How it works...
          3. There's more…
        3. Displaying the contact information for a specific individual
          1. Getting ready
          2. How it works…
          3. How it works...
          4. See also
        4. Creating and saving a new contact
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
      13. 6. Hooking into Native Events
        1. Introduction
        2. Pausing your application
          1. How to do it...
          2. How it works...
          3. There's more...
        3. Resuming your application
          1. How to do it...
          2. How it works...
        4. Displaying the status of the device battery levels
          1. How to do it...
          2. How it works...
          3. There's more...
        5. Displaying network connection status
          1. How to do it...
          2. How it works...
          3. There's more...
        6. Creating a custom submenu
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
      14. 7. Working with XUI
        1. Introduction
        2. Getting started with XUI
          1. How to do it…
        3. Learning the basics of the library
          1. How to do it...
          2. How it works...
        4. DOM manipulation
          1. How to do it...
          2. How it works...
        5. Working with touch and gesture events
          1. How to do it...
          2. How it works...
        6. Updating element styles
          1. How to do it...
          2. How it works...
          3. There's more...
        7. Working with remote data and AJAX requests
          1. How to do it...
          2. How it works...
        8. Creating simple tweens and animations
          1. How to do it...
          2. How it works...
      15. 8. Working with the Ionic Framework
        1. Introduction
        2. Getting familiar with basics of the library
          1. How to do it...
          2. How it works…
        3. Exploring Ionic commands
          1. How to do it...
          2. How it works…
        4. Exploring the Ionic framework structure
          1. How to do it…
            1. Basic directory structure
            2. Configuration and resources
            3. Application files
          2. How it works…
          3. See also
        5. Using ngCordova
          1. How to do it...
          2. How it works…
      16. 9. Ionic Framework Development
        1. Introduction
        2. Exploring the UI components
          1. How to do it…
        3. Creating a layout
          1. How to do it…
          2. How it works…
        4. Using Ionic and Angular
          1. How to do it...
          2. How it works…
        5. Putting it all together
          1. How to do it…
          2. How it works…
      17. 10. User Interface Development
        1. Introduction
        2. Creating a jQuery Mobile layout
          1. Getting ready
          2. How to do it...
          3. How it works…
        3. Persisting data between jQuery Mobile pages
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        4. Using jQuery Mobile ThemeRoller
          1. How to do it...
          2. How it works...
          3. There's more...
      18. 11. Extending PhoneGap with Plugins
        1. Introduction
        2. Extending your Cordova Android application with a native plugin
          1. How to do it...
          2. How it works…
        3. Extending your Cordova iOS application with a native plugin
          1. How to do it...
          2. How it works...
        4. The plugin repository
          1. How to do it…
          2. How it works…
      19. 12. Development Tools and Testing
        1. Introduction
        2. Downloading Cordova
          1. How to do it...
          2. How it works...
        3. Using the command line to create a new iOS Cordova project
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Running the application on the iOS Simulator
            2. Debugging your application
        4. Debugging the iOS Cordova application using Safari Web Inspector
          1. How to do it…
          2. How it works…
        5. Using Android Studio to develop Android Cordova applications
          1. Getting ready
        6. Using Adobe Dreamweaver to develop Cordova applications
          1. Getting ready
          2. How to do it...
          3. How it works...
        7. Using the PhoneGap Build service
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Hydrating your application
            2. The PhoneGap Build API
      20. Index