ebook img

Appcelerator Titanium: Up and Running: Building Native iOS and Android Apps Using JavaScript PDF

153 Pages·2013·10.8 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Appcelerator Titanium: Up and Running: Building Native iOS and Android Apps Using JavaScript

www.it-ebooks.info www.it-ebooks.info Appcelerator Titanium: Up and Running John Anderson www.it-ebooks.info Appcelerator Titanium: Up and Running by John Anderson Copyright © 2013 John Anderson. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/ institutional sales department: 800-998-9938 or [email protected]. Editors: Andy Oram and Mike Hendrickson Cover Designer: Randy Comer Production Editor: Kara Ebrahim Interior Designer: David Futato Proofreader: Kara Ebrahim Illustrator: Rebecca Demarest March 2013: First Edition Revision History for the First Edition: 2013-03-08: First release See http://oreilly.com/catalog/errata.csp?isbn=9781449329556 for release details. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Appcelerator Titanium: Up and Running, the image of a golden lion tamarin, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trade‐ mark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. ISBN: 978-1-449-32955-6 [LSI] www.it-ebooks.info Table of Contents Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii 1. The Benefits of Titanium. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 When to Use Titanium 2 When Titanium Makes Sense 2 Cross-Platform Compatibility 3 Using Titanium for Just One Platform 5 When Titanium Doesn’t Make Sense 6 Mobile Landscape 8 PhoneGap 8 Sencha Touch 9 jQuery Mobile 9 jQTouch 10 MonoTouch 10 Where’s the GUI? 11 Death of Xcode and ADK? 11 Pricing and Support 12 2. Getting Set Up to Use Titanium. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Selecting a Development Environment 15 Setting Up Your Native SDKs 16 Other Hardware Prerequisites 18 External Displays 18 3. Titanium Studio. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Features of Titanium Studio 21 Automatic Syntax Checking 22 Autocomplete (Intellisense) 22 Debugging 23 iii www.it-ebooks.info Building Your App 24 Titanium Studio and Other Text Editors 25 4. A Hello World App. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Building Your First App 27 Writing the App 30 The Files in Your First Project 36 The tiapp.xml File 36 Build Folder 39 Events 41 Custom Events 42 5. Becoming a Capable Control Freak. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Basic UI Controls 48 Window-Based UI Controls 51 Picker Control 51 Option Control 52 Creating Your Own Composite Objects 54 The Customized Slider Object 54 Custom Attributes on Controls 60 More Uses for Custom Controls 63 The Main Event 64 Event Propagation 66 6. Titanium Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 App Object 69 Storing Data in the App Object 70 Pause and Resume Events 70 Background Services 71 Local Notifications 72 Window and View Objects 74 Window and View Layout 78 Layout 78 View Controllers 84 Navigation Group 85 TabGroup Object 89 Conclusion 91 7. Customizing Titanium. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 What’s in a Name...Space 93 Titanium Compatibility Layer (TiCL) 94 Version and Sharing Considerations 96 iv | Table of Contents www.it-ebooks.info Copying and Merging 96 Further Compatibility 98 Convenience Functions 102 Titanium Modules and Their Uses 104 How to Write a Module 104 Titanium Mobile Marketplace 105 Using a Titanium Module 106 Adding the Module 107 Referencing the Module 108 Calling a Module from Titanium Code 110 Appcelerator Cloud Services 111 8. Titanium App Storage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 Local File Storage 113 Database Storage 114 ResultSets 116 9. Distribution Methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 Apple’s App Store 119 Custom B2B Apps 120 Apple’s Enterprise Distribution 120 Android’s Marketplace 126 10. API Reference. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 Titanium 130 Titanium.API 130 Titanium.Accelerometer 132 Titanium.Analytics 132 Titanium.Android 132 Titanium.Android.currentActivity 133 Titanium.Android.Calendar 133 Titanium.Android.NotificationManager 133 Titanium.App 134 Titanium.App.Android 134 Titanium.App.iOS 134 Titanium.App.Properties 135 Titanium.Codec 135 Titanium.Contacts 135 Titanium.Database 135 Titanium.Facebook 136 Titanium.Filesystem 136 Titanium.Geolocation 136 Table of Contents | v www.it-ebooks.info Titanium.Gesture 136 Titanium.Locale 136 Titanium.Map 137 Titanium.Media 138 Titanium.Network 138 Titanium.Network.Socket 138 Titanium.Platform 138 Titanium.Stream 138 Titanium.UI 139 Titanium.UI.Android 139 Titanium.UI.Clipboard 139 Titanium.UI.iOS 139 Titanium.UI.iPad 139 Titanium.UI.iPhone 139 Titanium.UI.MobileWeb 140 Titanium.Utils 140 Titanium.XML 140 Titanium.Yahoo 140 vi | Table of Contents www.it-ebooks.info Preface Introduction Titanium allows you to create mobile applications on multiple platforms from a single codebase using native UI components. This allows you to create applications that per‐ form well, and look great across multiple operating systems. Conventions Used in This Book The following typographical conventions are used in this book: Italic Indicates new terms, URLs, email addresses, filenames, and file extensions. Constant width Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords. Constant width bold Shows commands or other text that should be typed literally by the user. Constant width italic Shows text that should be replaced with user-supplied values or by values deter‐ mined by context. This icon signifies a tip, suggestion, or general note. vii www.it-ebooks.info This icon indicates a warning or caution. Using Code Examples This book is here to help you get your job done. In general, if this book includes code examples, you may use the code in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of ex‐ ample code from this book into your product’s documentation does require permission. We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Appcelerator Titanium: Up and Running by John Anderson (O’Reilly). Copyright 2013 John Anderson, 978-1-449-32955-6.” If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at [email protected]. Safari® Books Online Safari Books Online (www.safaribooksonline.com) is an on-demand digital library that delivers expert content in both book and video form from the world’s leading authors in technology and business. Technology professionals, software developers, web designers, and business and crea‐ tive professionals use Safari Books Online as their primary resource for research, prob‐ lem solving, learning, and certification training. Safari Books Online offers a range of product mixes and pricing programs for organi‐ zations, government agencies, and individuals. Subscribers have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like O’Reilly Media, Prentice Hall Professional, Addison-Wesley Pro‐ fessional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technol‐ ogy, and dozens more. For more information about Safari Books Online, please visit us online. viii | Preface www.it-ebooks.info

Description:
Build native apps for iOS, Android, and Blackberry from a single JavaScript codebase with Appcelerator Titanium. This guide gets you quickly up to speed on this amazing framework and shows you how to generate cross-platform apps with 100% native controls. You'll also learn the advantages of using Ti
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.