Building Cross-Platform Apps using Titanium, Alloy, and Appcelerator Cloud Services

Book description

Skip Objective-C and Java to get your app to market faster, using the skills you already have

Building Cross-Platform Apps using Titanium, Alloy, and Appcelerator Cloud Services shows you how to build cross-platform iOS and Android apps without learning Objective-C or Java. With detailed guidance given toward using the Titanium Mobile Platform and Appcelerator Cloud Services, you will quickly develop the skills to build real, native apps— not web apps—using existing HTML, CSS, and JavaScript know-how. This guide takes you step-by-step through the creation of a photo-sharing app that leverages the power of Appcelerator's cloud platform, and establishes fundamental concepts before adding advanced techniques. Coverage extends beyond the development process to include expert advice for deployment on the App Store or Google Play, and more.

The mobile app market is estimated at over $2.4 billion per year. These apps were traditionally built using Objective-C or Java, which can be complex and daunting to learn. Now you can use JavaScript on the Titanium framework to build amazing apps that run native on iOS and Android devices, and get your app to market faster with this guide.

  • Integrate Cloud Services APIs into the app framework and UI

  • Set up user accounts, and capture and store photos

  • Work with location-based services and share via social media

  • Deploy on the App Store, Google Play, and more

  • When a great idea is in the works, no one wants to put it on hold to learn an entirely new skillset. Now there's an alternative. Get that app to market fast, using existing skills and powerful new tools, and grab a piece of that multi-billion-dollar market. Building Cross-Platform Apps using Titanium, Alloy, and Appcelerator Cloud Services is your ticket to the front of the line.

    Table of contents

      1. Introduction
      2. Chapter 1: Installing and Configuring Appcelerator
        1. Setting Up Titanium
        2. Installing Titanium on the Mac
          1. Installing Titanium Studio IDE
          2. Installing Xcode
          3. Installing the iOS Simulator
          4. Installing the Titanium Command-Line Interface to Use an Alternate IDE
          5. Installing the Android SDK
        3. Installing Titanium Studio on Windows
          1. Installing Titanium Studio
          2. Installing Android SDK
        4. Summary
      3. Chapter 2: Introducing Appcelerator Cloud Services
        1. Using the Appcelerator Cloud Services Console
        2. Using Appcelerator Cloud Services REST API
          1. Installing curl on a Device
          2. Simple Test with the REST API
        3. Integrating Appcelerator Cloud Services
        4. Simple Example of Integrating Appcelerator Cloud Services
        5. Summary
      4. Chapter 3: Appcelerator Titanium Alloy Overview
        1. Understanding the Model-View-Controller (MVC) Framework
        2. Using Appcelerator Alloy with the MVC Framework
          1. Backbone.js
          2. Backbone.js in Alloy: Models and Collections
        3. Using Sync Adapters
          1. Basic Sync Adapter Construction
          2. Backbone Model Events
        4. Model-View Data Binding
          1. Demo Project for Model View Binding
          2. Creating the Model File
          3. Creating the Collection Object
        5. Data Binding with Models in Appcelerator Titanium Alloy
          1. Updating the cars.js Controller File
          2. Creating the New Controller/View for the Detail Display
          3. Completing the Controller for the Detail View
        6. Creating Widgets
          1. Creating a More Complex Widget
        7. Summary
      5. Chapter 4: Building a Cross-Platform Social Photo-Sharing Application
        1. Using Balsamiq to Design Mockups
        2. Walking Through the Phone-Sharing App
          1. User Accounts
          2. Camera
          3. Photo Uploading
          4. Social Integration with Facebook
          5. Finding Friends
          6. Commenting and Rating of Media
          7. Push Notifications
          8. Application Flow
        3. Summary
      6. Chapter 5: Development Process for Cross-Platform Apps
        1. Creating the Project for This Chapter
        2. Preconfiguring Appcelerator Cloud Services
        3. Creating the User Interface
          1. Creating the Tab Group Files
          2. Enabling the Camera Functionality on the Feed Tab
          3. Adding a Custom Table Row to TableView
        4. Integrating the Camera Functionality into the Application
          1. Accessing the Device Camera in Appcelerator
          2. Adding Camera API Calls to Feed Controller
          3. Revisiting the FeedRow Controller
          4. Revisiting the Feed Controller to Add the Rows to the Table
          5. Adding Some Style to the Feed Table
        5. Using the Android ActionBar for the Camera Button
          1. Setting Up the index.xml View to Support the ActionBar
          2. Modifying the index.xml View to Support the ActionBar
        6. Adding the Alloy Sync Adapter and Appcelerator Cloud Services
          1. Creating the User Model
          2. Extending Alloy Models
          3. Logging the User In
          4. Creating Appcelerator Cloud Service Sync Adapter
          5. Creating the Photo Model
          6. Modifying the ACS Sync Adapter to Support the Photo Model
          7. Model and Sync Adapter Working Together
        7. Summary
      7. Chapter 6: Integrating Comments
        1. Creating the Comment Table View Layout
          1. Rendering the Rows Using a Different View and Controller
          2. Styling the Views to Match the Mockups
        2. Adding Logic to the Controllers
          1. Calling the New Controller from feed.js
          2. Coding the comment.js Controller
          3. Cross-Platform Support in Comment View
          4. Coding the commentRow Controller
        3. Adding Models and Collections for Querying Comments
        4. Finishing the Comment Controllers
          1. The commentRow Controller
        5. Connecting the Dots . . . Showing the Comment List
          1. Back to the feed and feedRow Controllers
        6. Adding a New Comment to a Photo
          1. Creating a New Comment Controller and View
          2. Adding Code to the Comment Input Controller
          3. Back to the Comment.js Controller
          4. Saving the Comment and Updating the Table
        7. Deleting Comments
        8. Summary
      8. Chapter 7: Integrating User Accounts with Appcelerator Cloud Services
        1. Adding the Login User Interface
        2. Updating the User Model
          1. User Create Account Method
          2. User Logout Method
          3. Additional User Management Methods
        3. Updating the Index Controller
          1. Set Up the Basics in the Index Controller
        4. Creating the Login Controller
          1. Logging in the User
          2. Creating the User Account
        5. Using Facebook for Account Creation
          1. Setting Up an Application to Use the Facebook Module
          2. Facebook Button in the login.xml File
          3. Facebook Method in the User Model
          4. Facebook Handler in Login Controller
          5. Updating User with Facebook Information
          6. Check for Facebook Authentication on Startup
          7. Logging Out of Facebook
        6. Summary
      9. Chapter 8: Working with Friends and Followers
        1. Creating the CommonJS Library in Alloy
          1. Adding the Code
        2. Adding the Friends User Interface
          1. Finishing Up the ListView with Style
        3. Introduction to Appcelerator Cloud Services Friends Object
          1. Modifying the ACS Sync Adapter to Support User Queries
          2. Modifying the ACS Sync Adapter to Support Friends
          3. Creating the Friend Relationship
          4. Finding Friend Relationships Based on a User’s ID
          5. Removing Friend Relationships from a User
          6. Extending the User Model to Support User-Specific Friends Functionality
        4. Integrating ListView Data-Binding with Friends Collections
          1. Revisiting the friends.xml File
        5. Integrating ListView Data-Binding with the Friends Controller
          1. Displaying All Users
          2. Displaying the Friends List
        6. Working with User and Friends Lists
          1. Removing a Friend from the Friends List
        7. Updating the Application to Be Friend- and Location-Aware
        8. Summary
      10. Chapter 9: Working with Maps and Locations
        1. Associating GPS Information When Saving a Photo
          1. Modifying the Photo Model
          2. Getting GPS Information from a Device
          3. Creating a CommonJS Library for Geolocation
          4. Updating the Feed Controller to Add Location to a Photo
        2. Displaying the Photo Location on a Map
          1. Android Support for Google Maps v2
          2. Adding the Map Component to MapView XML
        3. Displaying a Map of Photos Near Your Location
          1. Querying ACS Photo Objects Using Your Current Location
          2. Updating the User Interface to Show a Map View
          3. Changes in the feed.js Controller
          4. Responding to Clicks on Map Annotations
        4. Summary
      11. Chapter 10: Sharing via Facebook, Email, and Twitter
        1. Creating the CommonJS Library for Sharing Functions
        2. Facebook Permissions and Reauthorization
          1. Sharing to the Facebook Wall
          2. Sharing to the Facebook Album
          3. Revisiting and Refactoring the Progress Window Library
          4. Sharing to a Facebook Album
        3. Sharing an Image as an Email Attachment
        4. Twitter Integration with the social.js Module
          1. Setting Up Your Twitter Developer Account
          2. Adding social.js to Your Project
          3. Adding the shareImage Function
          4. Including the social.js Library in the Application
          5. Adding Functionality to the sharing.js Library
        5. Summary
      12. Chapter 11: Push Notifications
        1. Setting Up Push Notifications on Your Development Platform
          1. Apple Push Notifications Configuration
          2. Google Push Notifications Configuration
        2. Configuring Push Notifications in Appcelerator Cloud Services
        3. Creating the Push Notifications Library in an Application
          1. Creating the pushNotifications.js Library
          2. Getting the iOS Token
          3. Getting the Android Token
          4. Registering Callbacks
        4. Integrating Push in Your Application
          1. Registering for Push Notifications When the User Logs In
          2. Sending Notifications Using the Appcelerator Cloud Services Console
          3. Sending a Push Notification
          4. Sending a Notification When Posting a Photo
          5. Sending a Notification When Commenting on Photos
          6. Sending a Notification When Adding a New Friend
          7. Unregistering from Push Notifications When Logging Out
        5. Further Integration of Push Notifications in Your Application
        6. Summary
      13. Chapter 12: Settings and User Management
        1. Getting Started: View, Style, Controller
          1. Editing the View
          2. Editing the User Information in the Header Section
          3. Editing the User Information Style
        2. Handling Logout on Android and iOS
          1. Logging the User Out
          2. Logging Out of Appcelerator Push Notifications
          3. Logging Out from Appcelerator Cloud Services
          4. Logging Out from Social Media
        3. Returning to the Login Screen
          1. Setting the User’s Profile Picture
        4. Adding a Few Performance Enhancements
          1. Returning to the Feed Controller for Performance and UI Enhancement
          2. Additional Information from the User Account
          3. Adding Content to the Main View in the Settings Tab
          4. Platform-Specific User Interface for Switch Control
          5. Handling the Switch Initialization Values
          6. Displaying Push Notification Status
          7. Changing the Push Notification Status
        5. Summary
      14. Chapter 13: Going to Market: Deploying to the App Store and to Google Play
        1. Process Overview
          1. Registering for a Developer Account
          2. Signing Your Application
          3. Creating an App Record and Filling Out Metadata
          4. Publishing Your Binary to the Store
        2. iOS App Store Submission Process
          1. Signing Up for an iOS Developer Account
          2. Signing Your iOS Application
          3. Creating an iTunes Connect Record
          4. Publishing from Titanium Studio
        3. Uploading Your Binary to the App Store
        4. Google Play Submission Process
          1. Signing Up for a Google Play Developer Account
          2. Generating a Keystore for Publishing
        5. Publishing to Google Play
        6. Summary

    Product information

    • Title: Building Cross-Platform Apps using Titanium, Alloy, and Appcelerator Cloud Services
    • Author(s): Aaron Saunders
    • Release date: November 2014
    • Publisher(s): Wiley
    • ISBN: 9781118673256