SKIP THE SHIPPING
Use code NOSHIP during checkout to save 40% on eligible eBooks, now through January 5. Shop now.
Register your product to gain access to bonus material or receive a coupon.
This eBook includes the following formats, accessible from your Account page after purchase:
EPUB The open industry format known for its reflowable content and usability on supported mobile devices.
PDF The popular standard, used most often with the free Acrobat® Reader® software.
This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.
Using Apache Cordova 4, you can leverage native technologies and web standards to quickly build cross-platform apps for most mobile devices. You can deliver a high-end user experience where it matters, while radically simplifying code maintenance and reuse. Apache Cordova 4 Programming is the most concise, accessible introduction to this remarkable technology.
In this essential guide, expert mobile developer John Wargo quickly gets you up to speed with all the essentials, from installation, configuration, and tools, to building plugins and using Cordova’s powerful APIs. Wargo helps you make the most of Cordova 4’s major enhancements, while offering practical guidance for all versions, including Adobe PhoneGap. Full chapters are dedicated to five major mobile platforms: Android, iOS, Windows Phone, Firefox OS, and Ubuntu.
Using rich, relevant examples, Wargo guides you through both the anatomy of a Cordova app and its entire lifecycle, including cross-platform testing and debugging. Throughout, he illuminates Cordova development best practices, streamlining your development process and helping you write high-quality apps right from the start.
Topics include
Access the full code examples at cordova4programming.com, where you’ll also find updates reflecting Cordova’s continuing evolution.
This book is an ideal companion to Wargo’s authoritative collection of Apache Cordova code recipes for each Cordova API, Apache Cordova API Cookbook (Addison-Wesley, 2015).
Foreword xiii
Preface xv
Acknowledgments xxi
About the Author xxiii
Chapter 1: The What, How, Why, and More of Apache Cordova 1
An Introduction to Apache Cordova 1
What Is Adobe PhoneGap? 3
A Little PhoneGap/Cordova History 4
Cordova Components 4
Access to Native APIs 5
Cordova User Interface Capabilities 10
Supported Platforms 12
Cordova License 13
Working with Cordova 13
Putting Cordova to Best Use 18
Getting Support 20
Resources 20
Cordova Going Forward 23
Hybrid Application Frameworks 25
Wrap-Up 25
Chapter 2: Anatomy of a Cordova Application 27
Hello World! 27
Cordova Initialization 29
Leveraging Cordova APIs 35
Structuring Your Application’s Code 38
The Generated Web Application Files 41
Responsive Design and Cordova 45
Wrap-Up 50
Chapter 3: Configuring a Cordova Development Environment 51
Installing the Cordova CLI 51
Installing Plugman 69
Wrap-Up 70
Chapter 4: Using the Cordova Command-Line Interfaces 71
Troubleshooting 72
The Cordova CLI 75
The Plugman CLI 104
Wrap-Up 120
Chapter 5: The Mechanics of Cordova Development 121
Cordova Development Issues 121
Developing Cordova Applications 124
Configuring a Cordova Application 131
Testing Cordova Applications 134
Leveraging Cordova Debugging Capabilities 135
Debugging and Testing Using External Tools 139
Wrap-Up 156
Chapter 6: Automation and the Cordova CLI 157
Automating the Project Setup Step 157
Automating the Cordova Process 164
Wrap-Up 167
Chapter 7: Android Development with Cordova 169
Using the Android Developer Tools 170
Monitoring Application Activity Outside of the ADT IDE 191
Testing on a Physical Device 192
Using the Chrome Debugging Tools 195
Wrap-Up 202
Chapter 8: Firefox OS Development with Cordova 203
Firefox OS Developer Tools 203
Debugging with the Firefox OS Simulator 207
Debugging Applications on a Firefox OS Device 218
Wrap-Up 220
Chapter 9: iOS Development with Cordova 221
Working with Xcode 221
Testing Cordova Applications in Xcode 225
Using the Safari Web Inspector 227
Wrap-Up 233
Chapter 10: Ubuntu Development with Cordova 235
Installing the Cordova CLI on Ubuntu 235
Debugging Ubuntu Applications 237
Wrap-Up 243
Chapter 11: Windows Development with Cordova 245
Windows versus WP8 Projects and Cordova 245
Windows Phone Limitations and Security Restrictions 247
Windows Development System Requirements 249
Windows Phone Development Tools 250
Windows App Store Setup 251
Configuring a Windows Phone Device for Application Testing 251
Cordova Development Workflow Using Visual Studio 254
Using Visual Studio Tools for Apache Cordova 265
Wrap-Up 281
Chapter 12: Using PhoneGap Build 283
What Is PhoneGap Build? 283
Using PhoneGap Build 286
Wrap-Up 306
Chapter 13: Using the PhoneGap CLI 307
Getting Help 308
Project Management 309
Anatomy of the Default PhoneGap Application 310
PhoneGap CLI Workflow Differences 312
Interacting with the PhoneGap Build Service 312
Wrap-Up 315
Chapter 14: Working with the Cordova APIs 317
The Cordova Core APIs 317
Working with the Cordova API Documentation 319
Checking API Availability 320
Catching Errors 321
Setting Application Permissions 322
Cordova Objects 324
Alerting the User 326
Cordova Events 332
Hardware APIs 334
Globalization 347
Working with the Contacts Application 352
Playing/Recording Media Files 358
InAppBrowser 359
Splashscreen 367
StatusBar 367
Wrap-Up 371
Chapter 15: Cordova Development End to End 373
About the Application 373
Creating the Application 374
Using Merges 385
Application Icons 387
Testing the Application 389
Wrap-Up 396
Chapter 16: Creating Cordova Plugins 397
Anatomy of a Cordova Plugin 397
Creating a JavaScript-Only Plugin 398
Creating a Cordova Native Plugin 408
Publishing Plugins 431
Wrap-Up 435
Chapter 17: Using Third-Party UI Frameworks with Cordova 437
Adobe Topcoat 439
jQuery Mobile 444
Bootstrap 450
SAP OpenUI5 456
Ionic Framework 459
Onsen UI 464
Wrap-Up 468
Chapter 18: Using Third-Party Tools with Cordova 469
Code Validation Tools 469
Code Editors 473
Developer Productivity Enhancement Tools 485
Build Tools 494
Wrap-Up 503
Index 505