Developing Hybrid Applications for the iPhone: Using HTML, CSS, and JavaScript to Build Dynamic Apps for the iPhone (Developer's Library Series)

Paperback (Print)
Used and New from Other Sellers
Used and New from Other Sellers
from $1.99
Usually ships in 1-2 business days
(Save 95%)
Other sellers (Paperback)
  • All (23) from $1.99   
  • New (5) from $21.39   
  • Used (18) from $1.99   

Overview

“For those not ready to tackle the complexities of Objective-C, this is a great way to get started building iPhone apps. If you know the basics of HTML, JavaScript, and CSS, you’ll be building apps in no time.”

—August Trometer, Owner of FoggyNoggin Software, www.foggynoggin.com

Discover the Easier, Faster Way to Build High-Quality iPhone Applications

Now, you don’t need to dive headfirst into Objective-C to write state-of-the-art applications for the iPhone. You can use web development tools and technologies you already know: JavaScript, HTML, and CSS. In this book, long-time web and mobile application developer Lee S. Barney shows you how to use the QuickConnect and PhoneGap frameworks to create secure, high-quality, modular hybrid iPhone applications.

Lee S. Barney walks you through the entire hybrid iPhone development process, from creating great user interfaces to compiling, deploying, and executing applications. Along the way, he introduces techniques and sample code designed to streamline development, eliminate complexity, optimize performance, and leverage all iPhone’s native capabilities—from its accelerometer and GPS to its built-in database. Coverage includes

  • Using Dashcode and Xcode together to create unique, exciting hybrid iPhone applications
  • Using the QuickConnect JavaScript API to perform tasks ranging from vibrating the phone to accessing the accelerometer and GPS location data
  • Accessing native iPhone functionality using the PhoneGap JavaScript API
  • Storing, retrieving, and managing data on the iPhone, even without network access
  • Using XMLHttpRequest to access or synchronize remote data and use web services
  • Creating Google-based maps for your own app that work like those you see in the iPhone’s Maps application

This book systematically lowers the barriers to iPhone development, enabling web developers to build any iPhone application they can imagine without long development cycles or steep learning curves!

Read More Show Less

Product Details

  • ISBN-13: 9780321604163
  • Publisher: Addison-Wesley
  • Publication date: 7/10/2009
  • Series: Developer's Library Series
  • Pages: 195
  • Product dimensions: 6.90 (w) x 8.90 (h) x 0.50 (d)

Meet the Author

Lee S. Barney (Rexburg, Idaho) is a professor at Brigham Young University—Idaho in the Computer Information Technology Department of the Business and Communication College. He has worked as CIO and CTO of @HomeSoftware, a company that produced web-based, mobile data, and scheduling applications for the home health care industry. Prior to this, he worked for more than seven years as a programmer, senior software engineer, quality assurance manager, development manager, and project manager for AutoSimulations, Inc., the leading supplier of planning and scheduling software to the semiconductor industry. He is the author of Oracle Database AJAX & PHP Web Application Development.

Read More Show Less

Read an Excerpt

Preface

This book shows you how to create a new type of iPhone application: hybrid applications written in HTML, CSS, and JavaScript. Hybrid iPhone applications are standalone applications that run like regular applications on your iPhone, but don't require the files to live on a server on the Internet.

Creating hybrid iPhone applications reduces creation time and the learning curve required to get your application into the hands of your customers, because you don't have to learn Objective-C or have an intimate knowledge of the Cocoa frameworks.Hybrid Application Development Tools

This book covers the two most commonly used open-source JavaScript software packages for writing applications for the iPhone and iPod touch devices: QuickConnectiPhone and PhoneGap. These packages enable you to build applications that access native device features directly from JavaScript, such as vibration, GPS location information, the accelerometer, and many other thingsmdall without writing a single line of Objective-C or Cocoa.

QuickConnectiPhone, downloaded from http://quickconnect.pbwiki.com, exposes the most native device behavior and provides a highly engineered, full-featured framework for development use. QuickConnectiPhone dramatically reduces your application's time-to-market because part of the framework consists of all of the glue code you have to typically write in Objective-C, Cocoa, and JavaScript. Best of all, it does not require a remote server for hosting JavaScript, HTML, and CSS files.

The second package is PhoneGap, downloaded from http://phonegap.com. PhoneGap exposes fewer native behaviors and is a library rather than a full-fledgedframework. As a library, PhoneGap enables you to engineer your application any way you want. It does, however, require a remote server for hosting files.

To reduce the learning curve and improve your understanding, good, solid examples are used throughout this book.

If you want to create installable iPhone applications, have the web skills required, and if you want to create dynamic, compelling solutions that people will use, this book shows you how using these two packages.

Table P—1 compares what each package can do at the time of writing this book.Table P—1: Comparing the Features of QuickConnectiPhone and PhoneGap

Behavior/Data Available

QuickConnectiPhone

PhoneGap

GPS

Yes

Yes

Accelerometer

Yes

Yes

Vibrate

Yes

Yes

System sounds

Yes

Yes

Ad-hoc (Bonjour) networking

Yes

No

Sync cable networking

Yes

No

Browser-based database access

Yes

No

Shipped database access

Yes

No

Drag-and-drop library

Yes

No

AJAX wrapper

Yes

No

Record/Play audio files

Yes

No

Embedded Google maps

Yes

No

Charts and graphs library

Yes

No

How to Use This Book

Each chapter is organized into two parts. The first part shows you how to use the relevant feature of either QuickConnectiPhone or PhoneGap to accomplish a particular task, such as getting the current geolocation of the device. The second part of the chapter shows how the code behind the JavaScript call is written and how it works. You can decide how deep into the JavaScript and Objective-C you want to delve.

The book is organized as follows:


  • Chapter 1, "Developing with Dashcode and Xcode," teaches you how to use Dashcode and Xcode together with QuickConnectiPhone and PhoneGap to quickly create fun-to-use applications that run on the iPhone. This chapter includes basic Dashcode use and methods for moving your Dashcode application into Xcode for compiling and running on devices.
  • Chapter 2, "JavaScript Modularity and iPhone Applications," teaches you how to dramatically reduce your time to market by taking advantage of the modularity of the QuickConnectiPhone framework. How front controllers, application controllers, and JavaScript reflection are used in code is explained.
  • Chapter 3, "Creating iPhone User Interfaces," helps ensure that Apple App Store distribution approves your applications. It describes best practices for creating highly usable iPhone applications. The different types of applications usually created for iPhones are described as well as pitfalls to watch out for.
  • Chapter 4, "GPS, Acceleration, and Other Native Functions with QuickConnectiPhone," shows you how to get GPS, acceleration, and device description information, and it teaches you how to vibrate your phone and play and record audio files. You use the QuickConnectiPhone framework to access and use these device behaviors. These abilities give your applications a truly native, fun feel.
  • Chapter 5, "GPS, Acceleration, and Other Native Functions with PhoneGap," shows you how to get GPS, acceleration, and device description information as well as how to vibrate your phone and play and record audio files. You use the PhoneGap library to access and use these native device behaviors. These abilities give your applications a truly native, fun feel.
  • Chapter 6, "Embedding Google Maps," shows you how to put a Google map inside your application using QuickConnectiPhone. This is one of the most requested pieces of functionality that means you won't have to send your users to the map application!
  • Chapter 7, "Database Access," shows you how to get information from and store data in SQLite databases included in your application created with the QuickConnectiPhone framework. Do you need to ship a predefined set of data in a database with your new applications? Read this chapter.
  • Chapter 8, "Remote Data Access," Do you need to access and use data from remote servers and/or services in your installed application? Chapter 8 shows you how to make this easy with a wrapper that lets you pull information from anywhere. Maybe you need to get data from an online blog and merge it with a Twitter feed. QuickConnectiPhone's remote-data-access module makes it easy.

The following appendices are also included:

  • Appendix A, "Introduction to JSON," provides you with a brief introduction to JavaScript Object Notation (JSON). JSON is one of the most commonly used and easiest ways to transfer your data wherever it needs to go.
  • Appendix B, "The QuickConnectiFamily Development Roadmap," provides you with an overview of the growth of QuickConnectiPhone in the future. If you are planning on creating applications for iPhones and other platforms, such as Google's Android phones, Nokia phones, Blackberries, and desktops such as Mac OS X, Linux, and Windows you should take a look at this appendix.
  • Appendix C, "The PhoneGap Development Roadmap," provides an overview of the growth of PhoneGap in the future. If you plan to create applications for iPhones and other platforms (such as Google's Android phones, Nokia phones, and Blackberries) and desktops (such as Mac OS X, Linux, and Windows), you should take a look at this appendix.
Online Resources

QuickConnectiPhone and PhoneGap are undergoing rapid development. To keep up with the new functions and capabilities and to learn more, use the following links.

QuickConnectiPhone:

  • Download examples and the framework from https://sourceforge.net/projects/quickconnect/.
  • Review the development blog at http://tetontech.wordpress.com.
  • Read the Wiki at http://quickconnect.pbwiki.com/FrontPage.
  • Find the Google group at http://groups.google.com/group/quickconnectiPhone/,
  • Twitter at http://twitter.com/quickconnect.

PhoneGap:

  • Download examples and the framework from https://sourceforge.net/projects/phonegapinstall/.
  • Visit the web site at http://www.phonegap.com/.
  • Read the Wiki at http://phonegap.pbwiki.com/.
  • Find the Google group at http://groups.google.com/group/phonegap.
  • Twitter at http://twitter.com/phonegap.
Prerequisites

You need a basic understanding of HTML, CSS, and Javascript to effectively use this book. If you have created web pages using these tools, you are well on your way to creating iPhone applications. If you need help with Objecive-C in both QuickConnectiPhone and PhoneGap, it is provided. This book is not intended to be an introductory book on Objective-C or on how to use it to develop iPhone applications.

You need to download and install Apple's Xcode tools from the iPhone developer web site at http://developer.apple.com/iphone. This requires Mac OS X 10.5 or greater and an Intel-based Mac.

Although it isn't required, you should also have either an iPhone or an iPod touch, so you can test and run the applications on those devices.Contacting the Author

To contact the author by email, use quickconnectfamily@gmail.com. For other types of contact, use Twitter, the Wiki, and Google Group links provided earlier.

© Copyright Pearson Education. All rights reserved.

Read More Show Less

Table of Contents

Preface xiii

Chapter 1: Developing with Dashcode and Xcode 1

Chapter 2: JavaScript Modularity and iPhone Applications 25

Chapter 3: Creating iPhone User Interfaces 45

Chapter 4: GPS, Acceleration, and Other Native Functions with QuickConnect 75

Chapter 5: Hybrid Applications, GPS, Acceleration, and Other Native Functions with PhoneGap 95

Chapter 6: Embedding Google Maps 111

Chapter 7: Database Access 127

Chapter 8: Remote Data Access 155

Appendix A: Introduction to JSON 173

Appendix B: The QuickConnectFamily Development Roadmap 179

Appendix C: The PhoneGap Development Roadmap 183

Read More Show Less

Preface

Preface

This book shows you how to create a new type of iPhone application: hybrid applications written in HTML, CSS, and JavaScript. Hybrid iPhone applications are standalone applications that run like regular applications on your iPhone, but don't require the files to live on a server on the Internet.

Creating hybrid iPhone applications reduces creation time and the learning curve required to get your application into the hands of your customers, because you don't have to learn Objective-C or have an intimate knowledge of the Cocoa frameworks.

Hybrid Application Development Tools

This book covers the two most commonly used open-source JavaScript software packages for writing applications for the iPhone and iPod touch devices: QuickConnectiPhone and PhoneGap. These packages enable you to build applications that access native device features directly from JavaScript, such as vibration, GPS location information, the accelerometer, and many other thingsmdall without writing a single line of Objective-C or Cocoa.

QuickConnectiPhone, downloaded from http://quickconnect.pbwiki.com, exposes the most native device behavior and provides a highly engineered, full-featured framework for development use. QuickConnectiPhone dramatically reduces your application's time-to-market because part of the framework consists of all of the glue code you have to typically write in Objective-C, Cocoa, and JavaScript. Best of all, it does not require a remote server for hosting JavaScript, HTML, and CSS files.

The second package is PhoneGap, downloaded from http://phonegap.com. PhoneGap exposes fewer native behaviors and is a library rather than a full-fledged framework. As a library, PhoneGap enables you to engineer your application any way you want. It does, however, require a remote server for hosting files.

To reduce the learning curve and improve your understanding, good, solid examples are used throughout this book.

If you want to create installable iPhone applications, have the web skills required, and if you want to create dynamic, compelling solutions that people will use, this book shows you how using these two packages.

Table P—1 compares what each package can do at the time of writing this book.

Table P—1: Comparing the Features of QuickConnectiPhone and PhoneGap

Behavior/Data Available

QuickConnectiPhone

PhoneGap

GPS

Yes

Yes

Accelerometer

Yes

Yes

Vibrate

Yes

Yes

System sounds

Yes

Yes

Ad-hoc (Bonjour) networking

Yes

No

Sync cable networking

Yes

No

Browser-based database access

Yes

No

Shipped database access

Yes

No

Drag-and-drop library

Yes

No

AJAX wrapper

Yes

No

Record/Play audio files

Yes

No

Embedded Google maps

Yes

No

Charts and graphs library

Yes

No

How to Use This Book

Each chapter is organized into two parts. The first part shows you how to use the relevant feature of either QuickConnectiPhone or PhoneGap to accomplish a particular task, such as getting the current geolocation of the device. The second part of the chapter shows how the code behind the JavaScript call is written and how it works. You can decide how deep into the JavaScript and Objective-C you want to delve.

The book is organized as follows:

  • Chapter 1, "Developing with Dashcode and Xcode," teaches you how to use Dashcode and Xcode together with QuickConnectiPhone and PhoneGap to quickly create fun-to-use applications that run on the iPhone. This chapter includes basic Dashcode use and methods for moving your Dashcode application into Xcode for compiling and running on devices.
  • Chapter 2, "JavaScript Modularity and iPhone Applications," teaches you how to dramatically reduce your time to market by taking advantage of the modularity of the QuickConnectiPhone framework. How front controllers, application controllers, and JavaScript reflection are used in code is explained.
  • Chapter 3, "Creating iPhone User Interfaces," helps ensure that Apple App Store distribution approves your applications. It describes best practices for creating highly usable iPhone applications. The different types of applications usually created for iPhones are described as well as pitfalls to watch out for.
  • Chapter 4, "GPS, Acceleration, and Other Native Functions with QuickConnectiPhone," shows you how to get GPS, acceleration, and device description information, and it teaches you how to vibrate your phone and play and record audio files. You use the QuickConnectiPhone framework to access and use these device behaviors. These abilities give your applications a truly native, fun feel.
  • Chapter 5, "GPS, Acceleration, and Other Native Functions with PhoneGap," shows you how to get GPS, acceleration, and device description information as well as how to vibrate your phone and play and record audio files. You use the PhoneGap library to access and use these native device behaviors. These abilities give your applications a truly native, fun feel.
  • Chapter 6, "Embedding Google Maps," shows you how to put a Google map inside your application using QuickConnectiPhone. This is one of the most requested pieces of functionality that means you won't have to send your users to the map application!
  • Chapter 7, "Database Access," shows you how to get information from and store data in SQLite databases included in your application created with the QuickConnectiPhone framework. Do you need to ship a predefined set of data in a database with your new applications? Read this chapter.
  • Chapter 8, "Remote Data Access," Do you need to access and use data from remote servers and/or services in your installed application? Chapter 8 shows you how to make this easy with a wrapper that lets you pull information from anywhere. Maybe you need to get data from an online blog and merge it with a Twitter feed. QuickConnectiPhone's remote-data-access module makes it easy.

The following appendices are also included:

  • Appendix A, "Introduction to JSON," provides you with a brief introduction to JavaScript Object Notation (JSON). JSON is one of the most commonly used and easiest ways to transfer your data wherever it needs to go.
  • Appendix B, "The QuickConnectiFamily Development Roadmap," provides you with an overview of the growth of QuickConnectiPhone in the future. If you are planning on creating applications for iPhones and other platforms, such as Google's Android phones, Nokia phones, Blackberries, and desktops such as Mac OS X, Linux, and Windows you should take a look at this appendix.
  • Appendix C, "The PhoneGap Development Roadmap," provides an overview of the growth of PhoneGap in the future. If you plan to create applications for iPhones and other platforms (such as Google's Android phones, Nokia phones, and Blackberries) and desktops (such as Mac OS X, Linux, and Windows), you should take a look at this appendix.

Online Resources

QuickConnectiPhone and PhoneGap are undergoing rapid development. To keep up with the new functions and capabilities and to learn more, use the following links.

QuickConnectiPhone:

  • Download examples and the framework from https://sourceforge.net/projects/quickconnect/.
  • Review the development blog at http://tetontech.wordpress.com.
  • Read the Wiki at http://quickconnect.pbwiki.com/FrontPage.
  • Find the Google group at http://groups.google.com/group/quickconnectiPhone/,
  • Twitter at http://twitter.com/quickconnect.

PhoneGap:

  • Download examples and the framework from https://sourceforge.net/projects/phonegapinstall/.
  • Visit the web site at http://www.phonegap.com/.
  • Read the Wiki at http://phonegap.pbwiki.com/.
  • Find the Google group at http://groups.google.com/group/phonegap.
  • Twitter at http://twitter.com/phonegap.

Prerequisites

You need a basic understanding of HTML, CSS, and Javascript to effectively use this book. If you have created web pages using these tools, you are well on your way to creating iPhone applications. If you need help with Objecive-C in both QuickConnectiPhone and PhoneGap, it is provided. This book is not intended to be an introductory book on Objective-C or on how to use it to develop iPhone applications.

You need to download and install Apple's Xcode tools from the iPhone developer web site at http://developer.apple.com/iphone. This requires Mac OS X 10.5 or greater and an Intel-based Mac.

Although it isn't required, you should also have either an iPhone or an iPod touch, so you can test and run the applications on those devices.

Contacting the Author

To contact the author by email, use quickconnectfamily@gmail.com. For other types of contact, use Twitter, the Wiki, and Google Group links provided earlier.

© Copyright Pearson Education. All rights reserved.

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)