Beginning Building Mobile Application Development in the Cloud

Overview

Learn how to build apps for mobile devices on Cloud platforms

The marketplace for apps is ever expanding, increasing the potential to make money. With this guide, you'll learn how to build cross-platform applications for mobile devices that are supported by the power of Cloud-based services such as Amazon Web Services. An introduction to Cloud-based applications explains how to use HTML5 to create cross-platform mobile apps and then use Cloud services to enhance those apps. ...

See more details below
Paperback
$25.03
BN.com price
(Save 28%)$34.99 List Price

Pick Up In Store

Reserve and pick up in 60 minutes at your local store

Other sellers (Paperback)
  • All (34) from $4.57   
  • New (16) from $4.74   
  • Used (18) from $4.57   

Overview

Learn how to build apps for mobile devices on Cloud platforms

The marketplace for apps is ever expanding, increasing the potential to make money. With this guide, you'll learn how to build cross-platform applications for mobile devices that are supported by the power of Cloud-based services such as Amazon Web Services. An introduction to Cloud-based applications explains how to use HTML5 to create cross-platform mobile apps and then use Cloud services to enhance those apps. You'll learn how to build your first app with HTML5 and set it up in the Cloud, while also discovering how to use jQuery to your advantage.

  • Highlights the skills and knowledge you need to create successful apps for mobile devices with HTML5
  • Takes you through the steps for building web applications for the iPhone and Android
  • Details how to enhance your app through faster launching, touch vs. click, storage capabilities, and a cache
  • Looks at how best to use JSON, FourSquare, jQuery, AJAX, and more
  • Shares tips for creating hybrid apps that run natively

If you're interested in having your application be one of the 200,000+ apps featured in the iPhone store or the 50,000+ in the Android store, then you need this book.

Read More Show Less

Product Details

  • ISBN-13: 9781118034699
  • Publisher: Wiley
  • Publication date: 11/1/2011
  • Edition number: 1
  • Pages: 552
  • Sales rank: 1,386,218
  • Product dimensions: 7.40 (w) x 9.16 (h) x 1.02 (d)

Meet the Author

Richard Rodger is the CTO of FeedHenry Ltd, a company specializing in bringing the first tools to develop cloud based applications for mobile devices. He is currently a member of the W3C Web Applications Working Group, which defines the standard for mobile widget applications.

Read More Show Less

Read an Excerpt

Beginning Building Mobile Application Development in the Cloud


By Richard Rodger

John Wiley & Sons

Copyright © 2012 John Wiley & Sons, Ltd
All right reserved.

ISBN: 978-1-1180-3469-9


Chapter One

Introducing Cloud-Based Mobile Apps

WHAT YOU WILL LEARN IN THIS CHAPTER:

* Using your existing skills as a web developer to build mobile apps

* Understanding how HTML5 will be used as an app-development standard

* Learning how to dynamically create JavaScript functions

* Using the WebKit browser engine for app development

* Creating a mobile web app that responds to touch

* Installing and using the nginx web server

This book is for web developers who want to build mobile apps and cloud services. If you know HTML, CSS, and JavaScript, you already have the skills to build not only mobile apps but also the cloud services that power them.

The code examples in this book show you how to build complete apps. You are never left to put together the pieces yourself. The code is simple and includes error-handling logic, so you'll learn how to build production-ready apps and systems.

Over the course of this book, you will build three complete applications. You'll learn how to put together all the elements of the technology stack, and you'll learn about a wide range of technologies and services. This book will enable you to get to work but avoids unnecessary detail and theory.

This book is an accelerator for your skills. You can use it to efficiently make the leap into mobile and cloud development. Rather than attempting to be a reference for all the details, which you can find on the web anyway, it is a stepping stone for your skills.

HOW TO BUILD MOBILE APPS IN THE CLOUD

This book describes how to build apps that run on the new generation of smart mobile devices. It also shows how to build out the business logic behind these apps, and how to run that business logic in a cloud hosting environment, such as that provided by Amazon.

This book focuses on the two leading platforms: iPhone and Android. These two, between them, cover the vast majority of smartphones and provide access to the largest market.

NOTE In this book, the term iPhone should be taken as shorthand for any iOS-based device, including iPad and the iPod Touch devices. Similarly, the term Android refers to any device running Android version 2.1 or higher, including any of the Android tablets that are competing with the iPad.

It's important to understand the types of apps that can run on mobile devices:

* Mobile web apps — These apps are really just websites, designed to function in an app-like way. They run in a web browser on a device.

* Purely native apps — These apps are written in a device-specific language, using a device-specific programming interface: Objective-C for iPhone apps or Java for Android apps. Native apps can access all the capabilities of the device and can take many forms, from simple utility apps to advanced 3-D games.

* Hybrid native apps — For these apps, you use HTML to build the user interface but wrap the HTML in a native container. Such apps can access some of the native capabilities of the device but can still be developed using HTML.

In this book you will learn how to build mobile web apps and hybrid apps.

The other component that many apps have is not something that lives on the mobile device at all. It is the business logic, data storage, and service integration that support the operation of the code on the mobile device. This element of app development is just as important as the visible part that you install on your device. Placing this code in a cloud-hosting environment is the best approach to developing a robust support system for your app, and this book shows you how to build the server elements of your app. You will learn how to do this by using your existing JavaScript skills. You'll run your code on the server using Node.js, a high-speed, high-capacity JavaScript server engine.

Using Your Existing Skill Set

As a web developer, you already possess all the skills you need to be a mobile app developer as well. If you can build websites, you can build mobile apps. If you are a web developer wanting to build mobile apps, you do not need to learn new languages such as Objective-C or Java. You do not even need to learn new languages to build the code for servers that support your app.

All you need to know is HTML, CSS, and JavaScript. This book assumes that you have a working knowledge of these three basic web languages. Even if you are more comfortable with design and graphics and are stronger in HTML and CSS than in JavaScript, you will still be able to follow the examples in this book and build your own apps.

This book takes a practical approach and shows you how to build real applications. The examples stick to common language features and avoid anything esoteric. The first set of code examples in this chapter lay the JavaScript ground work that will see you through to the end of the book.

You will use your existing skill set to build mobile web apps. You will then support those apps by using some server-side JavaScript, running on cloud servers, and you'll see all the steps needed to set this up. Then you'll learn how to create hybrid native apps using HTML, CSS, and JavaScript.

Determining What Tools You Need

You'll need some development tools in order to fully explore the examples in this book. You will certainly find a physical iPhone or Android device very useful for testing and development. You need to run mobile apps on an actual device to really understand how they will behave once users get hold of them.

To a certain extent, you can develop the apps and code examples in this book on any of the three major operating systems: Mac, Windows, or Linux. However, you will find that a Mac is the best choice, simply because the iPhone development tools from Apple can only run on a Mac. Your Mac can also run the server code quite easily. One thing you should do is upgrade to the latest version of the Mac OS X operating system, as this will support the most up-to-date versions of the iPhone development tools.

Windows and Linux are also acceptable, although you will have to do a little more configuration and setup work. In particular, on Windows, you will need to install the Cygwin UNIX environment so that you can run Node.js. Cygwin is available from www.cygwin.com. As discussed in Chapter, 11, you will also have to rely on third-party services to build hybrid native iPhone apps.

You can build mobile web apps and the necessary server code using your existing development tools. All you need is a good code editor, and I'm sure you've already chosen a favorite for coding websites. You'll also be using the command line quite a bit, especially for the server code. But don't worry if you're not comfortable with the command line; this book gives you exactly the commands you need to run.

Later in this book, you'll need to download and install the software development kits (SDKs) for iPhone and Android development. These SDKs are provided as part of the Xcode (for iPhone) and Eclipse (for Android) development environments. Xcode runs only on a Mac, but you can run Eclipse on all three operating systems.

The final development tool you'll use is the Safari web browser. You can download this directly from the Apple website: www.apple.com/safari. You will use Safari as a test and deployment tool because Safari is built with the open source WebKit browser engine. This browser engine is used on both iPhone and Android, and it is the web browser environment for which you need to develop. In your coding work cycle, you will use the desktop Safari browser as your test system.

The Skills You'll Learn

As you work through this book, you'll learn and enhance a wide range of skills. These skills will cover the entire mobile app technology stack, from the device, to the server, to the database. These will be practical skills, and theory will be kept to a minimum. All the code examples in this book create complete, fully working apps. You'll be able to use them as foundations for your own work.

You'll make good use of the new features in HTML5 when you build mobile web apps and HTML5-based native apps. The Safari browser and the WebKit engine have good support for many of the features of HTML5. You'll be able to use local on-device storage, app caching, geolocation, and even audio and video support.

You'll also learn about the special metatags and design considerations needed for mobile web app development. These allow you to deal with different screen sizes and device capabilities. They also allow you to define home screen icons and loading screens for your app.

To make the transition from a mobile web app to a hybrid native app, you'll use the open source PhoneGap project. This project provides a framework that allows you to embed your HTML in a native container. This is how you will build native apps using JavaScript. PhoneGap also provides you with an extended set of JavaScript functions that let you access the device camera and use the device accelerometer to detect movement.

The app on a device is only part of the story. The aim of this book is to teach you how to create mobile apps that provide complete services. This means you'll need to write server code that handles some of your business logic, such as user account management, user data storage, and integration with third-party cloud services. You'll also learn how to provide social media logins using Facebook and Twitter.

You will use JavaScript to build the server-side logic. You'll run your JavaScript in an application server known as Node.js (or more commonly, just "Node"), a JavaScript server created using the Google JavaScript engine from the Chrome web browser. Node is amazingly fast and designed to handle thousands of concurrent clients, so it's perfect for running a popular app.

You'll need a place to put your server-side code, so you'll learn how to host your code in the cloud, using Amazon Web Services (AWS). AWS is a full cloud-hosting system provided by Amazon that lets you create your servers and store images and files; it provides a nearly infinite database. You'll learn how to set up and configure an Amazon server and how to access the Amazon services over the web.

Finally, you'll learn how to work with next-generation databases that go beyond traditional tables, columns, and rows. You'll learn how to work with these schemaless database systems and how to synchronize them with the data on your mobile device.

TWO BIG IDEAS ABOUT THE APP INDUSTRY

This book is based on two predictions about where the app industry is going:

* Cloud computing will be the primary way to build the service infrastructure for apps — Most app developers accept this idea.

* Using HTML5 is a great way to build apps and will only become better — This view is still quite controversial.

The following sections take a closer look at these predictions and how they affect you, as a web developer and as a mobile app developer.

Web Apps and the Future

There are two types of web apps: mobile web apps and hybrid native apps. A mobile web app is delivered as a website and runs in a web browser on a mobile device. You can bookmark web apps on the home screen of the device, and you can give them icons and loading screens (as you'll see in Chapter 4). The user experience with mobile web apps is essentially different from that of native apps, but you can remove many of the differences.

The other type of web app, the hybrid native app, is actually a native app that runs a web browser inside itself. The entire app user interface is actually a web page that runs your HTML5 code. You use wrapper systems, such as the open source PhoneGap, to create a native wrapper. The native wrapper is a native app, but it only really does two things: create a WebView control (the native element that displays HTML) and provide access to device capabilities such as the camera via a JavaScript API.

This book will show you how to create both types of apps. You should carefully consider which approach is the best choice. The huge advantage of mobile web apps is that they are ultimately just websites, which means they do not have to be submitted to any app stores for approval. You can update them as frequently as you like, and they can be accessed from almost all smartphones (although functionality may be limited outside the iPhone and Android platforms).

However, hybrid native apps have the advantage of being proper apps that are listed in the app stores. They can use a device to its full potential, and you can extended these apps with native code, if necessary. You might be surprised to learn that a great many "purely" native apps actually make extensive use of HTML5 WebView controls. This is the main way to display rich text interfaces, even for purely native apps.

The following are the main reasons to develop an app using HTML5, whether as a mobile web app or within a hybrid native wrapper:

* Cross-platform — Your app is automatically cross-platform, and you have to develop it only once. The minor debugging required to handle device browser differences is inconsequential compared to the huge effort required to port an entire app from one platform language to another.

* Standards compliant — Long after the current set of mobile platforms have become historical entries in Wikipedia, your HTML5 app will still be running. HTML, as a technology choice, is a completely safe bet. It is quickly becoming the primary means of building user interfaces on any device, including tablet computers.

* Lower-cost rapid development — Developing your app with HTML, CSS, and JavaScript means that you can build and iterate extremely quickly. You have the advantage of many tools that support HTML, along with a wide pool of developer talent. Even if your ultimate goal is to create a native hybrid app, you can still do most of your development using a web browser, which means a much faster work cycle.

* Low-friction deployment — You can launch and update mobile web apps immediately, without waiting for a third-party approval process. You have complete control over content, user base, and commercial activities. No vendor is powerful enough to control the web.

* Easy to learn — You already have a good knowledge of web languages, so you can start building apps right away just by learning to deal with the particularities of mobile web app development. You do not need to invest any time in learning a new language such as Objective-C, which has limited use outside its own ecosystem.

* JavaScript — One important reason to build apps with HTML5 is that you will use JavaScript as your development language. Long-neglected as a toy scripting language and useful only for form validation and drop-down menus, JavaScript is emerging as the next big industry language. This change is happening because it is now possible to use JavaScript not only for websites but also for mobile apps and for server code. JavaScript is one of the few languages that can cover the entire technology stack.

JavaScript has certain weaknesses, including an unfortunate syntax inherited from the C language. But it is also capable of supporting advanced functional and object-oriented programming styles. You'll see examples of this power in many of the code examples in this book. With JavaScript, you need relatively few lines of code to quickly build complex apps, and you can easily debug those apps interactively in your web browser. As a result, when you adopt JavaScript as your primary language for mobile and cloud development, you will experience a huge increase in your software development productivity.

The Cloud as the Future

Cloud computing means many things. For mobile app developers, it provides the ability to build apps that millions of people can use. Cloud computing makes it easier to handle large and growing numbers of users.

This book shows you how to build your own cloud-based system from the ground up, using the Amazon cloud. You can use the same basic approach with other cloud vendors, such as Rackspace or Joyent. Chapter 11 covers the use of higher-level services that completely remove the need for any server configuration and just run your code for you.

You do not need to use traditional server-side languages such as Java or C# to build the cloud element of your app. You do not even need to know any of the existing scripting languages, such as Ruby, Python, or PHP. By using the Node server, you can run JavaScript on the server side. This means you can use a single language for all your development. You can stay focused on what you need to do, without being distracted by the differences between programming languages.

(Continues...)



Excerpted from Beginning Building Mobile Application Development in the Cloud by Richard Rodger Copyright © 2012 by John Wiley & Sons, Ltd. Excerpted by permission of John Wiley & Sons. All rights reserved. No part of this excerpt may be reproduced or reprinted without permission in writing from the publisher.
Excerpts are provided by Dial-A-Book Inc. solely for the personal use of visitors to this web site.

Read More Show Less

Table of Contents

INTRODUCTION xxi

CHAPTER 1: INTRODUCING CLOUD-BASED MOBILE APPS 1

How to Build Mobile Apps in the Cloud 2

Using Your Existing Skill Set 2

Determining What Tools You Need 3

The Skills You’ll Learn 4

Two Big Ideas About the App Industry 4

Web Apps and the Future 5

The Cloud as the Future 6

Getting Started 7

Using JavaScript Functions 7

The WebKit Browser Engine 20

A Colorful Little App 21

Introducing the nginx Web Server 25

Summary 29

CHAPTER 2: MOBILIZING YOUR APP 31

Building a Touch-Sensitive Drawing App 32

How to Draw on the Screen 32

Drawing in Response to Touch Events 39

Applying the DRY Principle to Your Code 46

Using the Amazon Cloud 52

How Geography Aff ects Amazon AWS 54

Using the Elastic Compute Cloud 54

Deploying Your Mobile Web App 61

Deploying Your Mobile App to the Instance 65

Summary 67

CHAPTER 3: BUILDING MOBILE WEB APPS 71

What You Can Do with Mobile Web Apps 71

Locating Your User 72

Responding to Device Orientation 74

More Features for Later 76

Installing Mobile Web Apps on iPhone Devices 76

Installing Mobile Web Apps on Android Devices 77

Introducing jQuery and jQuery Mobile 78

The jQuery Library 78

The jQuery Mobile Library 83

Building a To-Do List App 91

Summary 108

CHAPTER 4: ENHANCING YOUR APP 111

Using App Caching 112

Handling Touch Events 115

Touch Events 116

Gesture Events 118

Embedding an Interactive Map 127

The Google Maps API 127

Providing an Application Icon and a Startup Screen 131

Summary 132

CHAPTER 5 : BUILDING APPS IN THE CLOUD 135

Server-Side JavaScript 136

Introducing Node 136

Installing Node 138

Using the Node Package Manager 141

Introducing the MongoDB Database 144

Cloud Analytics for Your To-Do List App 150

Doing the Math 150

Organizing Your System 152

Collecting the Usage Data 160

Submitting the Usage Data 164

Charting the Usage Data 167

Summary 174

CHAPTER 6: USE THE CLOUD! 177

The Classic Cloud Architecture 177

The REST Approach 178

Cloud Databases 179

Introducing Amazon SimpleDB 180

The SimpleDB Approach to Cloud Storage 180

The SimpleDB API 181

Putting the To-Do List App in the Cloud 182

Introducing the simpledb Library 182

Building a Command-Line Client 188

Working on Cloud Time 196

Running a Cloud Server 198

Synchronizing with the Cloud 203

Summary 209

CHAPTER 7: ENHANCING THE USER EXPERIENCE 211

Creating a Classic Tab Bar Interface 211

Implementing the jQuery Mobile Solution 212

Using the iScroll Solution 216

Enabling Mobile Audio and Video 222

Playing Audio in Your App 222

Playing Video in Your App 226

Launching Apps from Your App 230

Launching a Web Browser from Your App 230

Launching a Phone from Your App 230

Launching SMS from Your App 230

Launching Mail from Your App 231

Launching Maps from Your App 231

Launching YouTube from Your App 231

Summary 232

CHAPTER 8: WORKING WITH THE CLOUD 235

Storing Content in Amazon S3 236

The Architecture of Amazon S3 236

Using Amazon S3 238

Signing In with the Cloud 247

Building Large-Scale Apps 255

Getting the Big Picture Right 256

Using the Cache! 258

Summary 271

CHAPTER 9: CREATING HYBRID APPS THAT RUN NATIVELY 273

Introducing Hybrid Apps 274

The PhoneGap Project 274

Building Hybrid Apps 275

Building an iPhone App 275

Understanding Code-Signing 276

Building an Android App 283

Using Device Features 288

Lifestream, a Photo-Blogging App 294

Uploading Pictures 295

Storing Pictures on Amazon S3 306

Summary 310

CHAPTER 10: BUILDING A PHOTO-BLOGGING APP 315

The Architecture of Lifestream 316

Building the Server 317

Laying the Foundation 317

Enabling User Following 333

Uploading and Posting Pictures 336

Completing the Lifestream App 345

Supporting User Accounts 346

Integrating Social Network Identity 357

Summary 368

CHAPTER 11: WORKING WITH CLOUD DEVELOPMENT SERVICES 371

Getting to Know the Mobile App Development Platforms 372

Using the FeedHenry Platform 373

FeedHenry Technology 374

The FeedHenry Development Environment 375

Deciding to Use FeedHenry 376

Using the Appcelerator Platform 377

Appcelerator Technology 378

The Appcelerator Development Environment 379

Deciding to Use Appcelerator 380

Using the appMobi Platform 381

appMobi Technology 382

The appMobi Development Environment 383

Deciding to Use appMobi 384

Summary 384

CHAPTER 12: GOING SOCIAL! 387

Using the Twitter API 388

Working with the Twitter API Usage Limits 390

Using the Entities that the Twitter API Exposes 390

The Parts You Need 391

An App for Direct Messages 395

The Design Process 395

Getting the Hygiene Factors Right 399

The Code Structure 404

OAuth Without a Server 413

Calling the Twitter API 421

Event Consumers and Producers 425

Summary 431

CHAPTER 13: APP STORES 435

What You Need to Publish Your App 436

Icons 436

Splash Screen 438

Screenshots and Orientations 439

App Metadata 440

Working with the App Stores 440

Building Your App for Release 441

Summary 452

CHAPTER 14: SELLING YOUR APP 455

Determining a Marketing Strategy 456

Building Apps for Others 457

Using Apps to Promote Your Business 458

Selling Your Own Apps 460

Choosing Tactics for Promoting Your App 462

Standard Tactics 463

Expensive Tactics 465

Guerrilla Tactics 466

Summary 468

APPENDIX: EXERCISE SOLUTIONS 471

INDEX 505

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)