You are previewing Appcelerator Titanium Application Development by Example Beginner's Guide.
O'Reilly logo
Appcelerator Titanium Application Development by Example Beginner's Guide

Book Description

Over 30 interesting recipes to help you create cross-platform apps with Titanium, and explore the new features in Titanium 3

  • Covers iOS, Android, and Windows8

  • Includes Alloy, the latest in Titanium design

  • Includes examples of Cloud Services, augmented reality, and tablet design

In Detail

Appcelerator Titanium is the leading method for creating native cross-platform apps. This book guides you from the initial stages with the language right through to the submission of your app to the marketplace/app store. Specially crafted examples cover the most common requirements of an app programmer. This book will be your companion as you progress with the language.

"Appcelerator Titanium Application Development by Example Beginner's Guide" will guide you through the process of designing cross-platform apps using Titanium. It covers all areas of the language from installation through development to submission to the store.

This book will take a hands-on approach in teaching you how to write cross-platform apps using Titanium, as well as exploring the new features of Titanium 3. Each chapter will show you how to overcome specific challenges using Titanium. You will learn how to design your apps using MVC principles and Alloy, use the cloud to your advantage, develop apps that work on tablets and phones, use the phone gadgets like the accelerometer, integrate social media, record usage using analytics, and monetise your app. All tasks from installation to deployment to the store are covered and backed by examples. The book will be your companion from your first steps with Titanium to successful live deployment.

Table of Contents

  1. Appcelerator Titanium Application Development by Example Beginner's Guide
    1. Table of Contents
    2. Appcelerator Titanium Application Development by Example Beginner's Guide
    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. Time for action – heading
        1. What just happened?
        2. Pop quiz – heading
        3. Have a go hero – heading
          1. Reader feedback
          2. Customer support
          3. Downloading the example code
          4. Errata
          5. Piracy
          6. Questions
    8. 1. How to Get Up and Running with Titanium
      1. System requirements and restrictions
      2. Installing Titanium
      3. Time for action – installing Titanium Studio
        1. What just happened?
      4. Setting up Titanium Studio
      5. Time for action – setting up Titanium Studio
        1. What just happened?
      6. Installing the Android SDK
      7. Time for action – configuring the Android SDK
        1. What just happened?
      8. Installing the iOS SDK
      9. Time for action – configuring the iOS SDK
        1. What just happened?
      10. Installation problems – did something go wrong?
      11. Your first cross-platform app
      12. Time for action – creating an app from a template
        1. What just happened?
      13. Time for action – running an app in the emulator
        1. What just happened?
        2. Did the app fail to run?
      14. A review of the first app
      15. tiapp.xml
        1. tiapp XML structure explained
        2. Other files in the base directory
        3. The Resources directory
          1. app.js
          2. KS_nav_ui.png and KS_nav_views.png
          3. The Android and iPhone directories
        4. Pop quiz - Titanium installation and configuration
      16. Summary
    9. 2. How to Make an Interface
      1. What's in the toolkit?
      2. A recap
      3. Window
      4. Tab group and tabs
        1. Creating a tab group
        2. Creating a tab
      5. Labels
      6. Views
      7. Time for action – adding a view to a window
        1. What just happened?
      8. Time for action – adding a button to a view
        1. What just happened?
      9. Time for action – making something happen when the button is pressed
        1. What just happened?
      10. Adding a settings screen – a TableView masterclass
      11. Time for action – adding a new window
        1. What just happened?
      12. Time for action – adding a styled TableViewRow object
        1. What just happened?
      13. Platform-specific tools
        1. Adding an Android menu
      14. Time for action – adding an Android menu
        1. What just happened?
      15. Time for action – running the Android menu changes on iOS
        1. What just happened?
          1. Why did this fail?
        2. Isolating platform-specific code
      16. Time for action – add an iOS fix for the Android menu
        1. What just happened?
      17. Capturing debug messages
        1. Coding iOS specific elements
      18. Time for action – adding an info button to the navigation bar
        1. What just happened?
      19. Summary
    10. 3. How to Design Titanium Apps
      1. JSON
      2. Extending your app over multiple files
        1. Titanium.include
      3. Time for action – creating an activity indicator
        1. What just happened?
      4. Require
        1. Require – loading a marketplace module
      5. Time for action – adding an Appcelerator marketplace module
        1. Have a go hero - enhancing the paint app
        2. Require – promoting commonJS compliant code
      6. MVC
      7. Time for action – creating a better designed app using MVC
        1. What just happened?
      8. Behind the scenes – a look at the code
        1. What does this mean?
        2. An example of require
      9. Alloy
      10. Time for action – creating an Alloy app
        1. What just happened?
        2. Pop quiz - Titanium design
      11. Summary
    11. 4. Gluing Your App Together with Events, Variables, and Callbacks
      1. Sharing data
        1. Execution context
      2. Global variables
        1. What is the right way to share data?
      3. Time for action – sharing information between windows
        1. What just happened?
      4. Events

        1. Event scope
        2. Event properties
        3. Making something happen – fireEvent
      5. Time for action – creating a progress bar game
        1. What just happened?
        2. Global event listeners and garbage collection
        3. Better event code using callbacks
        4. Have a go hero - adding callbacks
        5. Pop quiz - events
      6. Summary
    12. 5. It's All About Data
      1. External data
      2. Time for action – creating an HTTP request
        1. What just happened?
      3. RSS reader
      4. Time for action – fetching RSS
        1. What just happened?
      5. Time for action – parsing and displaying the RSS
        1. What just happened?
      6. Storing data on the device
        1. Which one should you use; filesystem, database, or properties?
      7. Storing data in files
        1. Storing data in the database
      8. Storing settings in Ti.App.Properties
      9. Time for action – comparing the speed of database, file, and application properties
        1. What just happened?
      10. YQL
      11. Time for action – creating a foreign exchange list
        1. What just happened?
        2. Have a go hero - adding offline storage
        3. Pop quiz - data handling
      12. Summary
    13. 6. Cloud-enabling Your Apps
      1. Before the cloud
      2. Which cloud services can you use with Titanium?
        1. Clouds are everywhere
      3. Appcelerator Cloud Services
      4. Time for action – creating ACS custom objects
        1. What just happened?
      5. Uploading pictures
      6. Time for action – uploading a photo to the cloud
        1. What just happened?
      7. Fetching ACS stored content
      8. Time for action – creating a panel to show commentary entries
        1. What just happened?
      9. Parse
      10. Time for action – storing custom objects using Parse
        1. What just happened?
      11. StackMob
      12. Other cloud offerings
      13. Choosing your cloud service
        1. Pop quiz - cloud services
      14. Summary
    14. 7. Putting the Phone Gadgets to Good Use
      1. The camera
      2. Time for action – using the camera
        1. What just happened?
      3. Time for action – selecting a photo from the photo library
        1. What just happened?
        2. Have a go hero - e-mailing a camera photo
      4. The accelerometer
      5. Time for action – showing the accelerometer on a slider
        1. What just happened?
      6. Time for action – smoothing the accelerometer response
        1. What just happened?
        2. Have a go hero - tuning the filer response
      7. The compass
      8. Time for action – displaying the compass heading
        1. What just happened?
      9. Augmented reality
      10. Time for action – creating a simple augmented reality app
        1. What just happened?
        2. Have a go hero - extending the AR example
      11. Maps
      12. Time for action – adding a map
        1. What just happened?
      13. Time for action – adding annotations to a map
        1. What just happened
      14. Directions
      15. Time for action – adding directions to a map
        1. What just happened?
      16. Geolocation
        1. Are we allowed to get the location?
      17. Accuracy and battery life
      18. Time for action – getting the current location
        1. What just happened?
        2. Have a go hero - getting the address of a location using reverse geocoding
      19. Computing the distance from a coordinate
      20. Time for action – getting the distance from a coordinate
        1. What just happened?
      21. Showing the user's current location on a map
      22. Time for action – showing the user's location on the map
        1. What just happened
        2. Pop quiz - gadgets
      23. Summary
    15. 8. Creating Beautiful Interfaces
      1. How to position and size items on a window?
        1. So what is a DIP and what's so good about it?
      2. Time for action - making DIPs the default unit for your app
        1. What just happened?
        2. What about percentages?
        3. Using views to create your layout
      3. Orientation
        1. Restricting the orientation
      4. Time for action – restricting the orientation of your app (iPhone)
        1. What just happened?
      5. Time for action – restricting the orientation of your app [Android]
        1. What just happened?
        2. Changing the orientation manually
      6. Time for action – forcing an orientation change (all platforms)
        1. What just happened?
      7. Creating layouts for phones and tablets
      8. Time for action – creating a multiplatform interface
        1. What just happened?
      9. Time for action – creating a phone layout for your app
        1. What just happened?
        2. Pop quiz - creating a layout
      10. Summary
    16. 9. Spread the Word with Social Media
      1. Facebook
      2. Time for action – registering your app with Facebook
        1. What just happened?
      3. Time for action – sending a screenshot to Facebook
        1. What just happened?
      4. Sending tweets
      5. Time for action – registering your app with Twitter
        1. What just happened?
      6. Time for action – sending a tweet
        1. What just happened?
      7. Sharing and social media on Android
      8. Time for action – sharing an update using intents
        1. What just happened?
        2. Pop quiz - integrating social media
      9. Summary
    17. 10. Sending Notifications
      1. How push notifications work
        1. Why do you need to know this?
      2. Setting up notifications - the prerequisites
        1. Setting up iOS notifications
      3. Time for action – getting a push certificate
        1. What just happened?
      4. Push notifications using Appcelerator Cloud
      5. Time for action – registering for push notifications with Appcelerator Cloud
        1. What just happened?
        2. Have a go hero - sending push notifications
      6. Push notifications using Urban Airship
      7. Time for action – registering for push notifications with Urban Airship
        1. What just happened?
        2. Coding the interface to Urban Airship
      8. Time for action – registering a device for push notifications
        1. What just happened?
        2. Have a go hero - sending a notification from Urban Airship
        3. Pop quiz - push notifications
      9. Summary
    18. 11. Testing and Deploying
      1. Registering your app with Apple
      2. Time for action – registering your app with Apple
        1. What just happened?
        2. Installing a development/distribution certificate
      3. Time for action – installing a development certificate
        1. What just happened?
      4. Running the app on devices
        1. Testing the app on iOS
      5. Time for action – running the app on an iOS device
        1. What just happened?
        2. Testing the app on Android
      6. Time for action – configuring your Android device
        1. What just happened?
      7. Debug your app
      8. Publishing your app
        1. iOS
          1. All iOS platforms
          2. iPhone
          3. iPad
        2. Android
        3. Deploying the app to the Apple App Store
      9. Time for action – deploying the app to the Apple App Store
        1. What just happened?
        2. Deploying the app to Google Play
      10. Time for action – deploying the app to Google Play
        1. What just happened?
        2. Pop quiz - deploying your app
      11. Summary
    19. 12. Analytics
      1. Comparing the providers
      2. Flurry
      3. Time for action – setting up Flurry
        1. What just happened?
        2. Tracking page views
      4. Time for action – registering a page view
        1. What just happened?
        2. Tracking custom events
      5. Time for action – registering a custom event
        1. What just happened?
        2. Other items you can gather
      6. Google Analytics
      7. Time for action – setting up Google Analytics
        1. What just happened?
        2. Tracking page views
      8. Time for action – registering a page view
        1. What just happened?
        2. Tracking custom events
      9. Time for action – registering a custom event
        1. What just happened?
      10. Analytics using Appcelerator
      11. Time for action – setting up Appcelerator Analytics
        1. What just happened?
        2. Catching custom events
      12. Time for action – registering a custom event
        1. What just happened?
      13. Other suppliers
        1. Pop quiz - recording analytics
      14. Summary
    20. 13. Making Money from Your App
      1. Displaying adverts in your app
      2. Time for action – configuring Google AdMob
        1. What just happened?
      3. Time for action – incorporating AdMob into your app
        1. What just happened?
      4. In-app purchases
      5. Time for action – adding in-app purchases for iOS
        1. What just happened?
        2. Have a go hero - recording a purchase
        3. In-app purchases on Android
      6. Time for action – adding in-app purchases for Android
        1. What just happened?
        2. Pop quiz - making money from your app
      7. Summary
    21. A. Git Integration
      1. Importing a project
      2. Time for action – importing an existing GitHub project
        1. What just happened?
      3. Time for action – uploading a project to GitHub
        1. What just happened?
        2. Alternative suppliers
      4. Summary
    22. B. Glossary
    23. C. Pop Quiz Answers
      1. Chapter 1, How to Get Up and Running with Titanium
        1. Pop quiz - Titanium installation and configuration
      2. Chapter 3, How to Design Titanium Apps
        1. Pop quiz - Titanium design
      3. Chapter 4, Gluing Your App Together with Events, Variables, and Callbacks
        1. Pop quiz - adding callbacks
      4. Chapter 5, It’s All About Data
        1. Pop quiz - data handling
      5. Chapter 6, Cloud-enabling Your Apps
        1. Pop quiz - cloud services
      6. Chapter 7, Putting the Phone Gadgets to Good Use
        1. Pop quiz - gadgets
      7. Chapter 8, Creating Beautiful Interfaces
        1. Pop quiz - creating a layout
      8. Chapter 9, Spread the Word with Social Media
        1. Pop quiz - integrating social media
      9. Chapter 10, Sending Notifications
        1. Pop quiz - push notifications
      10. Chapter 11, Testing and Deploying
        1. Pop quiz - deploying your app
      11. Chapter 12, Analytics
        1. Pop quiz - recording analytics
      12. Chapter 13, Making Money from Your App
        1. Pop quiz - making money from your app
    24. Index