Book Image

PhoneGap for Enterprise

By : Kerri Shotts
Book Image

PhoneGap for Enterprise

By: Kerri Shotts

Overview of this book

Table of Contents (16 chapters)
PhoneGap for Enterprise
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

Mobile devices are virtually ubiquitous among the enterprise workforce, and employees are becoming increasingly mobile. This book discusses how the enterprise workforce can take advantage of Apache Cordova/Adobe PhoneGap applications to create cross-platform hybrid mobile applications that can serve the varied needs of the user and the enterprise.

This book will cover the various aspects of typical hybrid app architecture, from the backend database and web servers all the way to the hybrid app that resides on the employee's device. As the security of the enterprise data is paramount, a large amount of time is focused on ensuring that the communication between the backend and the user's device is secure. The book also covers how to respond to changes in network connectivity and application state.

A code package is also available for this book. Inside, you'll find a complete backend database and web server as well as a frontend hybrid application called Tasker. The entire project is presented as an example that you can learn from and apply to other projects. The link to the code package is given later on in this section.

What this book covers

Chapter 1, PhoneGap and Enterprise Mobility, discusses the history of Apache Cordova/Adobe PhoneGap applications, presents reasons why Cordova/PhoneGap is a good fit for the enterprise, and how Cordova facilitates cross-platform development for Cordova and hybrid application architecture.

Chapter 2, Building the Data Store and Business Logic, introduces you to the typical backend server architecture, as well as designing the data models and business logic. You will also get introduced to Tasker, the demonstration app for this book.

Chapter 3, Securing PhoneGap Apps, shows the importance of ensuring the security of enterprise data. This chapter also covers backend security, general security, and issues that relate directly to Cordova/PhoneGap apps.

Chapter 4, Building the Middle Tier, discusses RESTful-like APIs and HATEOAS (Hypertext As The Engine Of Application State). A sample Node.js server is included as a demonstration of these topics, including examples of connecting to databases, executing queries, and generating appropriate responses.

Chapter 5, Communicating Between Mobile and the Middle Tier, demonstrates how to ultilize XMLHttpRequest (XHR), SSL Certificate fingerprints, and third-party Cordova/PhoneGap plugins in order to facilitate secure communication between the mobile application and the backend servers.

Chapter 6, Application Events and Storage, briefly discusses how to respond to changes in network events and application state. This chapter also introduces a third-party SQLite plugin for persistent data storage and an additional plugin to access the iOS Keychain for secure data storage.

Chapter 7, Push Notifications, covers typical Push Notification architecture, and introduces you to Boxcar.io, a service that provides an HTTP API to send pushes. It also introduces a PhoneGap API to respond to these push notifications.

Chapter 8, Building the Presentation Tier, covers many of the different patterns used to build a mobile application, including mock-up tools, various libraries and frameworks, common patterns (MVC, data binding, templates, and so on), forms and validation, and data visualization.

Appendix, Useful Resources, provides web links to resources that the reader might find useful for further learning. These are split chapterwise so that they can relate to a specific chapter in this book.

What you need for this book

In order to run the example code within the code package for this book, you'll need the following software:

If you intend to build the Cordova/PhoneGap demonstrations locally on your machine, you'll also need to install the appropriate SDKs and prerequisite software. For more information, see: http://cordova.apache.org/docs/en/edge/guide_cli_index.md.html#The%20Command-Line%20Interface.

Who this book is for

The content of this book assumes that the reader has experience with the following:

  • JavaScript (ECMAScript 5+)

  • CSS3

  • HTML5

  • Cordova/PhoneGap 3.6+

  • Some experience with Node.js or similar server software (like PHP)

  • Some experience with databases (such as SQLite, MySQL, Oracle, and so on)

This book is aimed at the employee who desires to utilize (or who has been tasked with utilizing) Cordova/PhoneGap software to build mobile hybrid applications for the enterprise. As such, the book focuses on various enterprise technologies (including Oracle and Node). It also deals with a lot of security issues.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "If the activity finished successfully, we call deferred.resolve with the value."

A block of code is set as follows:

  function interpolate( str, context ) {
    var newStr = str;
    if ( typeof context === "undefined" ) {
      return newStr;
    }
    str.match( /\{([^\}]+)\}/g ).forEach( function ( match ) {
      var prop = match.substr( 1, match.length - 2 ).trim();
      newStr = newStr.replace( match,
        valueForKeyPath( context, prop ) );
    } );
    return newStr;
  }

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

  function interpolate( str, context ) {
    var newStr = str;
    if ( typeof context === "undefined" ) {
      return newStr;
    }
    str.match( /\{([^\}]+)\}/g ).forEach( function ( match ) {
      var prop = match.substr( 1, match.length - 2 ).trim();
      newStr = newStr.replace( match,
        valueForKeyPath( context, prop ) );
    } );
    return newStr;
  }

Any command-line input or output is written as follows:

cordova plugin add https://github.com/EddyVerbruggen/SSLCertificateChecker-PhoneGap-Plugin.git

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "clicking the Next button moves you to the next screen".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

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.

The code for this book is also available on GitHub at https://github.com/kerrishotts/PhoneGap-Enterprise-Code-Bundle. This repository may be updated from time to time in order to fix any errors or issues discovered.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.