You are previewing Appcelerator Titanium Smartphone App Development Cookbook - Second Edition.
O'Reilly logo
Appcelerator Titanium Smartphone App Development Cookbook - Second Edition

Book Description

Over 100 recipes to help you develop cross-platform, native applications in JavaScript

About This Book

  • Leverage your JavaScript skills to write mobile applications using Titanium Studio tools with the native advantage

  • Deploy your application on the App Store and Google Play

  • Add your own IOS native modules in objective-C, in an easy-to-follow step-by-step format

  • Who This Book Is For

    This book is an essential for any developer learning or using JavaScript who wants to write native UI applications for iOS and Android. No knowledge of Objective-C, Swift and Java is required and you’ll quickly be developing native, cross-platform apps, in JavaScript!

    What You Will Learn

  • Transfer data between applications with URL schemes, and make your application accessible to other mobile applications and services

  • Connect with remote services using JSON

  • Work with Google Maps and Apple Maps, GPS and annotate routes

  • Create animations and special effects

  • Integrate notifications and connect with social media services such as Facebook and Twitter

  • Build applications with Alloy MVC – a rapid application development framework

  • Design native APIs and use local databases

  • In Detail

    The mobile web has paved the way but many users want to have “native” applications installed. Using Appcelerator as a platform it’s now possible to write iOS, Android, and Windows phone applications in JavaScript! It allows developers to develop fully native UI applications using Appcelerator studio tools without any knowledge of Objective-C, Swift or Java.

    This book will take you through the process of building cross-platform, native UI applications for the mobile from scratch. You will learn how to develop apps, how to use GPS, cameras and photos and how to build socially connected apps. You will also learn how to package them for submission to the App Store and Google Play.

    This cookbook takes a pragmatic approach to creating applications in JavaScript from putting together basic UIs, to handling events and implementation of third party services such as Twitter, Facebook and Push notifications. The book shows you how to integrate datasources and server APIs, and how to use local databases. The topics covered will guide you to use Appcelerator Studio tools for all the mobile features such as Geolocation, Accelerometer, animation and more. You’ll also learn about Alloy, the Appcelerator MVC framework for rapid app development, and how to transfer data between applications using URLSchemes, enabling other developers to access and launch specific parts of your app.

    Finally, you will learn how to register developer accounts and publish your very own applications on the App Store and Google Play.

    Style and approach

    This book offers a set of practical recipes with a step-by-step approach for building native applications for both the iOS and Android using JavaScript. This hands-on guide shows you exactly how to use the Appcelerator platform to rapidly develop cross-platform, native apps.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

    Table of Contents

    1. Appcelerator Titanium Smartphone App Development Cookbook Second Edition
      1. Table of Contents
      2. Appcelerator Titanium Smartphone App Development Cookbook Second Edition
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      8. 1. Building Apps Using Native UI Components
        1. Introduction
        2. Building with windows and views
          1. Getting ready
          2. How to do it...
          3. How it works…
        3. Adding a tabgroup to your app
          1. How to do it...
          2. How it works...
          3. There's more...
        4. Creating and formatting labels
          1. How to do it...
          2. How it works...
        5. Creating textfields for user input
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Retrieving text
            2. Experimenting with other textfield border styles
        6. Working with keyboards and keyboard toolbars
          1. Getting started
          2. How to do it...
          3. How it works...
          4. There's more
            1. Experimenting with keyboard styles
        7. Enhancing your app with sliders and switches
          1. How to do it...
          2. How it works...
          3. There's more…
        8. Passing custom variables between windows
          1. How to do it...
          2. How it works…
          3. There's more...
        9. Creating buttons and capturing click events
          1. How to do it...
          2. How it works...
        10. Informing your users with dialogs and alerts
          1. How to do it…
          2. How it works...
          3. There's more...
        11. Creating charts using Raphael JS
          1. Getting ready
          2. How to do it...
          3. How it works...
        12. Creating an actionbar in Android
          1. How to do it...
          2. How it works...
      9. 2. Working with Local and Remote Data Sources
        1. Introduction
          1. Prerequisites
        2. Reading data from remote XML via HTTPClient
          1. Getting ready
          2. How to do it...
          3. How it works…
        3. Displaying data using a TableView
          1. How to do it...
          2. How it works...
        4. Enhancing your TableViews with custom rows
          1. How to do it...
          2. How it works...
        5. Filtering the TableView using a SearchBar component
          1. How to do it...
          2. How it works...
        6. Speeding up your remote data access with Yahoo YQL and JSON
          1. How to do it...
          2. How it works...
        7. Creating a SQLite database
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Attaching a prepopulated database file
        8. Saving data locally using a SQLite database
          1. How to do it...
          2. How it works...
          3. There's more…
        9. Retrieving data from a SQLite database
          1. How to do it...
          2. How it works...
        10. Creating a "Pull to Refresh" mechanism in iOS
          1. How to do it...
          2. How it works...
      10. 3. Integrating Maps and GPS
        1. Introduction
        2. Adding a MapView to your application
          1. Getting ready
          2. How to do it...
          3. How it works…
          4. There's more...
            1. Changing your MapView's style
        3. Getting your current position using GeoLocation
          1. How to do it...
          2. How it works…
        4. Converting addresses to latitude and longitude locations
          1. How to do it...
          2. How it works…
        5. Adding annotations to your MapView
          1. How to do it...
          2. How it works...
        6. Customizing annotations and adding events to your MapView
          1. How to do it...
          2. How it works...
        7. Drawing routes on your MapView
          1. How to do it...
          2. How it works...
        8. Monitoring your heading using the device compass
          1. How to do it...
          2. How it works...
      11. 4. Enhancing Your Apps with Audio, Video, and Cameras
        1. Introduction
        2. Choosing your capture device using an OptionDialog modal
          1. Getting ready
          2. How to do it...
          3. How it works…
        3. Capturing photos from the camera
          1. How to do it...
          2. How it works…
        4. Choosing existing photos from the photo library
          1. How to do it...
          2. How it works…
          3. There's more
            1. Understanding media types
            2. Save to photos
        5. Displaying photos using ScrollableView
          1. How to do it...
          2. How it works…
        6. Saving your captured photo to the device filesystem
          1. How to do it...
          2. How it works…
        7. Capturing and playing audio via the audio recorder
          1. How to do it...
          2. How it works…
        8. Capturing video via the video recorder
          1. How to do it...
          2. How it works…
        9. Playing video files from the filesystem
          1. How to do it...
          2. How it works…
          3. There's more…
        10. Safely deleting saved files from the filesystem
          1. How to do it...
          2. How it works…
          3. There's more
      12. 5. Connecting Your Apps to Social Media and E-mail
        1. Introduction
        2. Composing and sending e-mails
          1. Getting ready
          2. How to do it...
          3. How it works…
          4. There's more
        3. Adding attachments to an e-mail
          1. How to do it...
          2. How it works...
        4. Setting up a custom Facebook application
          1. How to do it...
        5. Integrating Facebook into your Titanium app
          1. How to do it...
          2. How it works...
        6. Posting to your Facebook wall
          1. How to do it...
          2. How it works…
        7. Posting to Twitter in iOS
          1. How to do it...
          2. How it works...
        8. Posting to Facebook in iOS
          1. How to do it...
          2. How it works…
        9. Sharing on Android using Intents
          1. How to do it…
          2. How it works…
      13. 6. Getting to Grips with Properties and Events
        1. Introduction
        2. When should you use app properties?
          1. What object types can be stored as app properties?
        3. Reading and writing app properties
          1. Getting ready
          2. How to do it…
          3. How it works…
        4. Firing and capturing events
          1. How to do it…
          2. How it works…
        5. Passing event data between your app and a Webview using custom events
          1. How to do it…
          2. How it works…
          3. There's more
      14. 7. Creating Animations, Transformations and Implementing Drag and Drop
        1. Introduction
        2. Animating a view using the Animate method
          1. Getting ready
          2. How to do it…
          3. How it works…
        3. Animating a view using 2D Matrix and 3D Matrix transformations
          1. How to do it…
          2. How it works…
        4. Dragging an ImageView using touch events
          1. How to do it…
          2. How it works…
        5. Scaling an ImageView using the slider control
          1. How to do it…
          2. How it works…
        6. Saving our funny face using the toImage() method
          1. How to do it…
          2. How it works…
      15. 8. Interacting with Native Phone Applications and APIs
        1. Introduction
        2. Creating an Android options menu
          1. Getting ready
          2. How to do it…
          3. How it works…
        3. Accessing the contacts / address book
          1. How to do it…
          2. How it works…
        4. Storing and retrieving data via the clipboard
          1. How to do it…
          2. How it works…
        5. Creating a background service on an iPhone
          1. How to do it…
          2. How it works…
        6. Updating data using background fetch
          1. How to do it…
        7. Displaying local notifications on an iPhone
          1. How to do it…
          2. How it works…
        8. Displaying Android notifications using intents
          1. How to do it…
          2. How it works…
        9. Storing your Android app on the device's SD card
          1. How to do it…
          2. How it works…
      16. 9. Integrating Your Apps with External Services
        1. Introduction
        2. Connecting to APIs that use basic authentication
          1. Getting ready
          2. How to do it…
          3. How it works…
        3. Fetching data from the Google places API
          1. Getting ready
          2. How to do it…
          3. How it works…
        4. Connecting to FourSquare using oAuth
          1. Getting ready
          2. How to do it…
          3. How it works…
        5. Posting a check-in to FourSquare
          1. How to do it…
          2. How it works…
        6. Searching and retrieving data via Yahoo! YQL
          1. How to do it…
          2. How it works…
        7. Integrating push notifications with Parse.com
          1. Getting ready
          2. How to do it…
          3. How it works…
        8. Testing push notifications using PHP and HTTP POST
          1. How to do it…
          2. How it works…
      17. 10. Extending Your Apps with Custom Modules
        1. Introduction
        2. Integrating an existing module – the PayPal mobile payment library
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        3. Preparing your iOS module development environment
          1. How to do it...
          2. How it works…
        4. Developing a new iPhone module using XCode
          1. Getting ready
          2. How to do it…
          3. How it works…
        5. Creating a public API method
          1. Getting ready…
          2. How to do it…
          3. How it works…
        6. Packaging and testing your module using the test harness
          1. How to do it…
          2. How it works…
        7. Packaging your module for distribution and sale!
          1. How to do it…
          2. How it works…
      18. 11. Platform Differences, Device Information, and Quirks
        1. Introduction
        2. Gathering information about your device
          1. Getting ready
          2. How to do it…
          3. How it works…
        3. Obtaining the device's screen dimensions
          1. How to do it…
          2. How it works…
        4. Understanding device orientation modes
          1. How to do it…
          2. How it works…
        5. Coding around the differences between the iOS and Android APIs
          1. How to do it…
          2. How it works…
        6. Ensuring that your device can make phone calls
          1. How to do it…
          2. How it works…
      19. 12. Preparing Your App for Distribution and Getting It Published
        1. Introduction
        2. Joining the iOS developer program
          1. How to do it…
        3. Installing iOS developer certificates and provisioning profiles
          1. How to do it...
            1. Setting up your iOS developer certificate
            2. Setting up your device
            3. Creating your application provisioning profile
        4. Building your application for iOS using studio
          1. How to do it...
            1. Building your application for development
            2. Building your applications for distribution
        5. Joining the Google Android developer program
          1. How to do it…
        6. Creating your application's distribution key
          1. How to do it…
        7. Building and submitting your app to the Google Play Store
          1. How to do it…
      20. 13. Implementing and Using URL Schemes
        1. Introduction
        2. Detecting whether another iOS app is installed
          1. Getting ready
          2. How to do it...
          3. How it works…
        3. Launching another iOS app
          1. How to do it...
          2. How it works…
        4. Passing parameters to other apps via a URL
          1. How to do it...
          2. How it works…
        5. Launching Apple Maps and Google Maps with route directions
          1. How to do it...
        6. Opening URLs in Chrome for iOS
          1. How to do it
        7. Setting up your own apps to use URL schemes
          1. How to do it...
          2. How it works…
        8. Receiving URL commands in your own app
          1. How to do it…
          2. How it works…
        9. Transferring binary data between apps using a URL scheme
          1. How to do it…
      21. 14. Introduction to Alloy MVC
        1. Introduction
        2. Installing Alloy and creating an Alloy project
          1. How to do it...
        3. Building views and windows
          1. How to do it...
          2. How it works…
        4. Creating Buttons and Labels using Events
          1. How to do it...
          2. How it works…
        5. Changing the look of your app with styles
          1. How to do it…
          2. How it works…
        6. Working with Navigation and TabGroups
          1. How to do it…
          2. How it works…
        7. Adding an Alloy widget to your application
          1. How to do it…
          2. How it works…
        8. Creating your own Alloy widget
          1. How to do it…
          2. How it works…
        9. Integrating data using models and collections
          1. How to do it…
          2. How it works…
      22. Index