PhoneGap Essentials
eBook - ePub

PhoneGap Essentials

Ivan Turkovic

Share book
  1. 178 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

PhoneGap Essentials

Ivan Turkovic

Book details
Book preview
Table of contents
Citations

About This Book

Use PhoneGap to build cross-platform mobile applications quickly and efficiently

About This Book

  • Build native mobile phone applications with HTML5, JavaScript, and CSS
  • Incorporate smartphone capabilities such as GPS, camera, accelerometer, and more into your apps for any mobile platform
  • Use Cordova view to embed PhoneGap into native applications to either transit smoothly to PhoneGap or incorporate PhoneGap functionalities

Who This Book Is For

If you are a mobile application developer in iOS or Android, or a web application developer who wants to learn how to make cross-platform mobile applications using PhoneGap, this book is perfect for you. To make the most of this book, it will be helpful if you have prior knowledge of HTML5, CSS, and JavaScript.

What You Will Learn

  • Get to grips with the fundamentals of PhoneGap to get started
  • Set up a development environment for Linux, Mac OS, and Windows
  • Use Cordova CLI, workflows, and Plugman Plugin manager to create mobile applications efficiently
  • Understand the development workflow to create native cross-platform mobile applications
  • Embed plugin support to transition to PhoneGap or use it to enhance existing applications
  • Improve your mobile development knowledge using object-oriented programming (OOP), reusable components, and AJAX closures
  • Be empowered to build your own mobile apps quickly with ease
  • Discover tips and tricks to make app development fun and easy

In Detail

PhoneGap is an open source framework that allows you to quickly build cross-platform mobile apps using HTML5, JavaScript, and CSS. PhoneGap Build is a cloud service that allows you to quickly develop and compile mobile applications without SDKs, compilers, and hardware. PhoneGap allows you to use its existing plugins or create new ones, as per your requirements, to enhance your mobile applications.

Starting by installing PhoneGap, you'll develop an app that uses various device capabilities through different plugins and learn how to build an app in the cloud with PhoneGap's Build service.

You'll discover how to use PhoneGap to create an application view, along with how to use a camera, geolocation, and other device capabilities to create engaging apps. Next, you'll augment applications with PhoneGap's plugins using minimalistic code. You'll explore the app preparation process to deploy your app to the app store.

By the end of the book, you'll have also learned how to apply hybrid mobile UIs that will work across different platforms and different screen sizes for better user experience.

Style and approach

This is an example-based, fast-paced guide that covers the fundamentals of creating cross-platform mobile applications with PhoneGap.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is PhoneGap Essentials an online PDF/ePUB?
Yes, you can access PhoneGap Essentials by Ivan Turkovic in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming Mobile Devices. We have over one million books available in our catalogue for you to explore.

Information

Year
2015
ISBN
9781785284687
Edition
1

PhoneGap Essentials


Table of Contents

PhoneGap Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Get up and Running with PhoneGap
A brief history
What is PhoneGap?
Where can it be used?
What PhoneGap is not
Competition
PhoneGap or Cordova?
Setting up a local development environment
Mac OS
Linux
Windows
Summary
2. Mobile Platform Support
Supported platforms
Supported features by platform
Support for development
PhoneGap Build
Platform support
Using PhoneGap Build
The PhoneGap Developer App
How to use it
Summary
3. Command-line Interface
Introduction to a command-line interface
PhoneGap CLI versus Cordova CLI
Installing the PhoneGap CLI
Creating a new project
Creating a Hello project
Creating a new project
Managing platforms
Adding a platform
Listing platforms
Removing a platform
Keeping platforms up-to-date
Application description
Creating a project from a template
Managing the project
Application preview
Preparing an application
Compiling an application
Building an application
Running an application
Emulating an application
Using PhoneGap Build
Authentication
Preparing the application
Building the application
Summary
4. Plugin Support
Introducing plugins
What is a plugin?
Support for different mobile platforms
Installing plugins
Command-line Interface
Finding plugins
Adding plugins
Listing plugins
Removing plugins
Plugman
Installing Plugman
Searching for plugins
Installing plugins
Removing plugins
npm
Plugins
Battery Status
Camera
Contacts
Device
The Device Motion plugin
Device position orientation
Dialogs
FileSystem
File Transfer
Geolocation
Globalization
InAppBrowser
Media
Media Capture
Network Information
Splashscreen
Vibration
StatusBar
Summary
5. First PhoneGap Application
Starting a new application
Creating a new application
Setting up the initial code
Project folder structure
Core PhoneGap events
The deviceready event
The pause event
The resume event
Essential plugins
The Device plugin
The Network Information plugin
The StatusBar plugin
The Dialogs plugin
Summary
6. Accessing Native APIs
Native APIs
Device status plugins
Motion sensing plugins
Media functionality plugins
Notification plugins
The Battery Status plugin
The Battery Status event
The Low Battery event
The Critical Battery event
The Device Motion plugin
The getCurrentAcceleration method
watchAcceleration
clearWatch
The Device Orientation plugin
getCurrentHeading
watchHeading
clearWatch
The Geolocation plugin
getCurrentPosition
watchPosition
clearWatch
The Position object
The Coordinates object
The Vibration plugin
Vibrate
Standard vibrate
Vibrating with a pattern (Android and Windows only)
Cancelling the vibration (not supported in iOS)
Summary
7. Accessing Media Content
Introducing multimedia
Media
File management
Contacts
File Transfer
The FileTransfer object
The FileUploadResult object
Upload
Download
Abort
Contacts
Contact
The Contact object
ContactName
ContactField
ContactAddress
ContactOrganization
The create method
Find
pickContact
Camera
getPicture
cleanup
InAppBrowser
The InAppBrowser object
The InAppBrowserEvent object
Open
Summary
8. Application Development Workflow
An introduction to a development workflow
Web project development
Native platform development
Best practices
Use local assets for the UI
Network access for data
Non-blocking UI
CSS animations
Click events
Performance
Optimize the image assets
Offline status
Load only what you need
Transparency
JSHint
Testing
Debugging
Desktop browsers
The PhoneGap emulator
Weinre
iOS Debugging
Xcode
Safari Remote Debugging
Android debugging
User interface
Summary
Index

PhoneGap Essentials

Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: September 2015
Production reference: 1310815
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78528-468-7
www.packtpub.com

Credits

Author
Ivan Turkovic
Reviewers
Johnathan Iannotti
Yousuf Qureshi
Anthony Rumsey
Kasper Souren
Tomasz Trejderowski
Commissioning Editor
Neil Alexander
Acquisition Editor
Subho Gupta
Content Development Editor
Manasi Pandire
Technical Editor
Bharat Patil
Copy Editors
Stephen Copestake
Tasneem Fatehi
Project Coordinator
Suzann...

Table of contents