Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Appcelerator Titanium Application Development by Example Beginner's Guide

You're reading from   Appcelerator Titanium Application Development by Example Beginner's Guide Once you've got into Appcelerator Titanium you'll never look back. This book is the perfect introduction to developing native cross-platform apps for iOS, Android, and Windows 8.

Arrow left icon
Product type Paperback
Published in Apr 2013
Publisher Packt
ISBN-13 9781849695008
Length 334 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Darren Paul Cope Darren Paul Cope
Author Profile Icon Darren Paul Cope
Darren Paul Cope
Arrow right icon
View More author details
Toc

Table of Contents (23) Chapters Close

Appcelerator Titanium Application Development by Example Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. How to Get Up and Running with Titanium 2. How to Make an Interface FREE CHAPTER 3. How to Design Titanium Apps 4. Gluing Your App Together with Events, Variables, and Callbacks 5. It's All About Data 6. Cloud-enabling Your Apps 7. Putting the Phone Gadgets to Good Use 8. Creating Beautiful Interfaces 9. Spread the Word with Social Media 10. Sending Notifications 11. Testing and Deploying 12. Analytics 13. Making Money from Your App Git Integration Glossary
Pop Quiz Answers Index

tiapp.xml


This file lives in the base directory of your project and contains your global project settings and compile-time customizations. Titanium Studio provides a clean, simple overview interface to the main settings listed in the file, as shown in the screenshot under step 3 of the Time for action – creating an app from a template section. From the overview screen you can:

  • Add new external modules to your project such as a Twitter or PayPal module extension

  • Add Appcelerator cloud services

  • Change the Titanium SDK used to compile your app

  • Enable deployment targets for supported platforms

  • Change app version, description, and publisher details

When you open the tiapp.xml file you will notice that along with the overview there is a set of tabs at the bottom of the screen, which allows you to switch between the overview and the raw XML. There are a number of things that you can only change from the raw XML view of the file, for example allowed orientations, so it's worth getting familiar with it. The table given next provides a list of most configurable items within the file. You don't need to examine and learn the options now, in fact it doesn't make for great reading; you can refer to it when you need it. We will look at the effects of some of the settings later in the book.

tiapp XML structure explained

XML

Description

<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">

This is the standard XML header.

<deployment-targets>
        <target device="mobileweb">false</target>
        <target device="iphone">true</target>
        <target device="ipad">false</target>
        <target device="android">true</target>
        <target device="blackberry">false</target>
    </deployment-targets>

This is the list of supported devices. This can be changed from the overview screen.

<sdk-version>3.0.0.GA</sdk-version>
    <id>com.mycompany.firstapp</id>
    <name>FirstProject</name>
    <version>1.0</version>
    <publisher>Darren</publisher>
    <url>http://</url>
    <description>not specified</description>
    <copyright>2012 by Darren</copyright>
    <icon>appicon.png</icon>

These settings can be changed from the overview screen.

<persistent-wifi>false</persistent-wifi>

Does your app require a persistent Wi-Fi connection, or is the default that turns off after a period of inactivity ok?

<prerendered-icon>false</prerendered-icon>

This controls the shine/gloss effect that is added to icons on iOS. Setting this to true will prevent the gloss being added.

<statusbar-style>default</statusbar-style>

This is the status bar style. See Titanium.UI.iPhone.StatusBar in the API documentation to see allowable values.

<statusbar-hidden>false</statusbar-hidden>

Should the status bar be hidden?

<fullscreen>false</fullscreen>

Should the app start up using the full screen?

<navbar-hidden>false</navbar-hidden>

Should the navigation bar be hidden?

<analytics>true</analytics>

Do you want to gather analytic information about the app that will be automatically uploaded to the Appcelerator site?

<guid>d047116f-4ddb-4007-a24f-8702df42e59e</guid>

This is the unique internal identifier of your app. It is used with the analytics services. Do not change this value.

<property name="ti.ui.defaultunit">system</property>

 
<iphone>
<orientations device="iphone">
<orientation>Ti.UI.PORTRAIT</orientation>
</orientations>
<orientations device="ipad">
<orientation>Ti.UI.PORTRAIT</orientation>
<orientation>Ti.UI.UPSIDE_PORTRAIT</orientation>
<orientation>Ti.UI.LANDSCAPE_LEFT</orientation>
<orientation>Ti.UI.LANDSCAPE_RIGHT</orientation>
</orientations>
</iphone>

This lists the allowed orientations for the iOS devices you support. The options shown to the left restrict any displays on an iPhone to portrait (that is with the button at the bottom of the phone). All orientations will be supported by the iPad.

    <android xmlns:android="http://schemas.android.com/apk/res/android"/>

This lists compile-time directives for the Android generator if any. This is also where any AndroidManifest overrides are listed.

<mobileweb>
        <precache/>
        <splash>
            <enabled>true</enabled>
            <inline-css-images>true</inline-css-images>
        </splash>
        <theme>default</theme>
    </mobileweb>

These are the settings and controls for the generation of a mobile web app.

<modules/>

Any external modules added to the project will be listed here. This can all be done from the overview screen.

</ti:app>

This is the closing XML line.

The good news is that for this chapter you don't have to change any of these settings.

Other files in the base directory

There are several other files that were generated when the project was created.

The other files in the project root directory are all text files that do not affect the operation of the app. They will be bundled with your app when it is released. You can update them if you feel the need.

The Resources directory

The other main element created at project inception is the Resources directory that looks as follows:

It contains one important file, app.js.

app.js

app.js is the entry point of any Titanium project—the first line of code that is executed. It can be freely edited as you wish. We will look at the contents of this file in later chapters. For now just accept the contents of the file that have been generated.

KS_nav_ui.png and KS_nav_views.png

KS_nav_ui.png and KS_nav_views.png are the two icons that appear at the bottom of the screen on the tabs. They are needed for this app but are not important elements of other apps. They can be deleted if they are not used.

The Android and iPhone directories

The android and iphone directories under the Resources folder contain the app icons and splash screens for many different iOS and Android devices supported by your app. We will look in more detail at the contents of these directories in Chapter 11, Testing and Deploying.

Pop quiz - Titanium installation and configuration

Q 1. You want to develop apps on your windows PC using Titanium. What platforms can you test on the machine?

  1. iOS

  2. Android

  3. Symbian

Q 2. You will often need to refer to the app configuration file to change settings. Where can you find it?

  1. <project base directory>/manifest

  2. <project base directory>/resources/app.json

  3. <project base directory>/tiapp.xml

  4. <project base directory>/app.js

Q 3. What is the name of the source code file that is first run when an app starts?

  1. <project base directory>/app.js

  2. <project base directory>/resources/app.js

  3. <project base directory>/init.js

  4. <project base directory>/build/start.exe

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image