Beginning Building Mobile Application Development in the Cloud

Beginning Building Mobile Application Development in the Cloud

by Richard Rodger

View All Available Formats & Editions

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


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.

Product Details

Publication date:
Sales rank:
Product dimensions:
7.40(w) x 9.16(h) x 1.02(d)

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


* 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.


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 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: 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.


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.


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.

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.

Customer Reviews

Average Review:

Write a Review

and post it to your social network


Most Helpful Customer Reviews

See all customer reviews >