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 Affects 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