Preface

This is a book about Apache Cordova, the leading framework for building native mobile applications for multiple target platforms using HTML5 (HTML, JavaScript, and CSS). I created the book in order to help web developers and mobile developers understand how to use Apache Cordova to build hybrid applications for mobile devices. The book targets the specific capabilities provided in Apache Cordova 4 and subsequent versions.

As Adobe PhoneGap is just a distribution of Apache Cordova, this book is also about Adobe PhoneGap. You’ll find any differences between the two clearly described herein.

The book is written for mobile developers who want to learn about Apache Cordova 4. If you’re brand-new to Cordova, this book will be just what you need to get started. If you’re experienced with an older version of Cordova, this book can act as a refresher, plus it will show you in detail how to use all of the new stuff that’s in Cordova 4. You should have at least some experience with mobile development to directly benefit from this book. For web developers who want to get into mobile development using Apache Cordova, I’ve included content that shows you how to install and use the native SDKs, but I won’t cover many native-specific topics.

What you’ll find in the book:

Image Lots of detailed information about Apache Cordova, what it does, how it works, and how to use the available tools and APIs

Image Lots of examples and code; for even more code, be sure to check out my Apache Cordova API Cookbook (www.cordovacookbook.com)

What you won’t find in this book:

Image Mobile web development and mobile development topics; this is a book about Apache Cordova, not mobile development

Image Expressions or phrases in languages other than English (I hate it when authors include expressions from Latin or French)

Image Obscure references to pop-culture topics (although there is an overt reference to Douglas Adams’s Hitchhiker’s Guide to the Galaxy and one obscure reference to Monty Python)

Image Pictures of my children or my pets

This is not a book for experienced Cordova 4 developers—if you consider yourself an experienced Cordova 4 developer, you probably should not buy this book.

Herein I try to provide complete coverage of Apache Cordova 4, covering enough detail that readers will leave with a complete understanding of what Cordova is, what it does, how it works, and how to use it for their mobile application projects. There’s a whole lot more to Cordova—many advanced topics and more detailed coverage of the Cordova APIs, which can be found in the Cordova documentation or in blogs.

This book started many years ago as a book called PhoneGap Essentials (www.phonegapessentials.com); the book was all about PhoneGap 2.0 and was published right about the time the project name changed to Apache Cordova. The book came in at about 300 pages. The book’s first 150 pages covered the available tools and everything a developer needed to know to configure a development environment, and then create, write, build, and test PhoneGap applications. The second half of the book provided a detailed deep dive into each of the (at the time) PhoneGap APIs. The cool part of this second half was that for each API it included at least one complete, functional sample application that demonstrated each aspect of the API. The framework’s documentation was pretty useful in demonstrating how the API worked overall, but PhoneGap Essentials provided much more thorough examples.

The book went on to become the best-selling book on the topic, and it was used in university courses around the world. According to Amazon.com, people are still purchasing this book today.

With the release of Apache Cordova 3, I reworked the manuscript and published Apache Cordova 3 Programming (www.cordovaprogramming.com). This book also came in at 300 pages but was essentially a rewrite of just the first half of PhoneGap Essentials with only cursory coverage of the Cordova APIs provided. This allowed me to go into much more detail on the tools and development process.

Unfortunately, because Apache Cordova 3 Programming was available only as an ebook, it was hard to find, and many readers continued to buy PhoneGap Essentials even though it covered an older version of the framework.

In order to accommodate those readers who were more interested in the Cordova APIs, I reworked the second half of PhoneGap Essentials into another 300 pages called Apache Cordova API Cookbook (www.cordovacookbook.com). In this book, the complete example applications from PhoneGap Essentials were enhanced and expanded, and all of the book’s content was updated for the newer version of Cordova. I’d not covered some topics as well as I would have liked to in the first book, so this update allowed me to really expand the coverage of some topics and include even more complete sample applications (32, I think it was).

Between Apache Cordova 3 Programming and Apache Cordova API Cookbook, I had written more than 600 pages of coverage of Apache Cordova 3. That’s more than twice the size of the original book and a lot of good information for developers.

With this book, I’ve updated Apache Cordova 3 Programming for Apache Cordova 4, plus included new content on a bunch of topics. In my previous books, I focused primarily on PhoneGap and Apache Cordova; I didn’t cover many third-party tools and left many mobile development topics uncovered as well. For this book, there were a bevy of additional tools available and some hybrid-focused HTML frameworks, so I decided to cover as many of them as I could in the space available to me. Where this book’s predecessor was 300 pages, this one should top out at more than 500 pages, so there’s a lot of really good information here for all types of Cordova developers. When bundled with Apache Cordova API Cookbook, you’ll have more than 800 pages of information about Apache Cordova.

Herein you’ll find most of the same topics that were covered in Apache Cordova 3 Programming. The only missing topic is coverage of the BlackBerry platform. I wrote the first book on BlackBerry development and had pretty much always carried a BlackBerry device, but between books, BlackBerry experienced a dramatic drop in market share and I started carrying an Android device as my primary device. Additionally, in previous books I had the enthusiastic support of my former colleagues at BlackBerry, but when it came time to get feedback on the BlackBerry chapter in Apache Cordova 3 Programming, the development team stopped responding to my inquiries. Because of those two things I decided to drop support for BlackBerry from this book.

So, what new stuff have I added in this book? Coverage of

Image Plugman and the PhoneGap CLI

Image Cordova’s support for Firefox OS and Ubuntu devices

Image Automation (Grunt and Gulp) and Cordova CLI hooks

Image Microsoft’s hybrid toolkit for Visual Studio

Image Third-party tools such as AppGyver, GapDebug, THyM, and more

Image Third-party HTML frameworks such as Bootstrap, OpenUI5, Ionic, and Onsen UI

There’s a lot more, but these are some of the highlights.

The one thing I cover in the book but not in tremendous detail is how to build custom Cordova plugins. I cover the topic and show you how to create two complete plugins, but this isn’t a native mobile development book and that’s a native mobile development topic. I’ve learned from my readers that the material I do provide is enough to help a lot of people get started with plugins and create their own plugins; I’ll leave it up to another author to write a book dedicated to plugin development so it can get the attention it deserves.

Android Studio versus Android Developer Tools (ADT)

As I wrote the previous edition of this book, Google announced a new development tool called Android Studio. I expected then that Android Studio would be out before I started this manuscript and I’d be able to update the content for the new tool. As I worked through the book, Android Studio was still in beta and it was essentially incompatible with Cordova CLI-generated projects. I thought about hacking through it in order to provide updated content here, but after discussing my situation with Andrew Grieve from Google, I decided that it wasn’t yet ready for prime time and I would stick with ADT for this book.

Wouldn’t you know it, right after the book went into the editing process, Google finally released Android Studio. Sigh. At this point, I could make minor changes to the manuscript but couldn’t rewrite a complete chapter. So, unfortunately, some of the content you’ll find in Chapter 7, “Android Development with Cordova,” refers to the older version of the SDK. The stuff around the SDK is still valid, but Android Studio installs everything in a different place from what I’ve shown. The incompatible stuff is everything I showed about using the Eclipse tools. Sorry.

University Use

One of the pleasant surprises you have when delivering technical books is when a book is picked up for use in university courses. From what I can tell, several universities around the world use my Cordova books for their PhoneGap/Cordova class work. I regularly receive emails from university professors asking me questions about the book as they prepare to use it in their classes.

I was fortunate enough to hear from Dr. Robert Lutz from Georgia Gwinnett College. They were using my books (Apache Cordova 3 Programming and Apache Cordova API Cookbook) in class and they were close enough that I could drive there and see how it was working for them. I arranged a visit to the campus, and Dr. Lutz was kind enough to arrange a campus Tech Talk at the university. I spent about an hour talking about mobile development and the role hybrid applications play in the market. After the session ended, I spent some more time with the class using my book and let the students pick my brain on a number of topics. It was quite a lot of fun and allowed me to learn more about how my work is being used by others. I even signed a few copies of my books.

After this book is finished, my goal is to work with Dr. Lutz to prepare classroom material that can be used in conjunction with the book. Stay tuned on that one.

Cordova as a Moving Target

One of the challenges in writing a book about open-source projects is that if the project is well staffed and busy, it gets regular updates. In Cordova’s case, it’s one of the fastest-moving open-source projects on the planet, so with their regular updates and yearly major releases, it is definitely a moving target.

I’ve worked very hard to structure and craft this book so that it can survive the rapid pace of the project, but only time will tell. You may find that something I’ve written here has changed and the book doesn’t align with reality. There’s nothing I can do about this except to stay on top of it and post updates to the book’s web site (described below) when I find that something has changed enough that it breaks part of the book.

A Comment on Source Code

One of the things you’ll notice as you look at the source code included in the book is that I’ve paid special attention to the formatting of the code so that it can be easily read and understood by the reader. Rather than allowing the publisher to wrap the source code wherever necessary, instead I’ve forced page breaks in the code wherever possible in order to structure it in a way that should benefit the reader. Because of this, as you copy the source code over into your Cordova applications, you will likely find some extra line breaks that affect the functionality of the code. Sorry.

All of the book’s source code is available on GitHub (https://github.com/johnwargo/ac4p); there you’ll find the complete application source code in a format that will allow you to quickly copy the code into your apps.

The Book’s Web Site

The book has its own web site at www.cordova4programming.com. I will post there any updates and errata to the book. I’ll also answer questions I receive from readers. Please feel free to use the contact form on the book’s web site to provide feedback and/or suggestions for the next edition as well.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.103.8