`
rensanning
  • 浏览: 3546019 次
  • 性别: Icon_minigender_1
  • 来自: 大连
博客专栏
Efef1dba-f7dd-3931-8a61-8e1c76c3e39f
使用Titanium Mo...
浏览量:38098
Bbab2146-6e1d-3c50-acd6-c8bae29e307d
Cordova 3.x入门...
浏览量:607098
C08766e7-8a33-3f9b-9155-654af05c3484
常用Java开源Libra...
浏览量:682039
77063fb3-0ee7-3bfa-9c72-2a0234ebf83e
搭建 CentOS 6 服...
浏览量:89205
E40e5e76-1f3b-398e-b6a6-dc9cfbb38156
Spring Boot 入...
浏览量:401676
Abe39461-b089-344f-99fa-cdfbddea0e18
基于Spring Secu...
浏览量:69652
66a41a70-fdf0-3dc9-aa31-19b7e8b24672
MQTT入门
浏览量:91647
社区版块
存档分类
最新评论

tiapp.xml / timodule.xml 详解

阅读更多
【官方Guide】https://wiki.appcelerator.org/display/guides/tiapp.xml+and+timodule.xml+Reference

The tiapp.xml and it's close cousin the timodule.xml are XML configuration files that Titanium Mobile uses to generate native resources and code. Many of the configuration that lives in tiapp.xml is cross-platform, but some is platform-specific as well. The timodule.xml file is meant for custom Titanium Mobile Modules, and generally only contains platform-specific configuration.

Top Level Elements
These configuration elements live under the root <ti:app> tag of the tiapp.xml. Unless otherwise noted, the configuration value goes inside the tag's content, i.e. <element>VALUE</element>

  • <id>: The application ID. In Android, this ID is used to generate the package ID of the application, which must follow Java Package Naming Standards
  • <name>: The application name. This is generally what is shown under the application icon on the end-user's mobile device.
  • <version>: The application version.
  • <publisher>: The publisher of this application.
  • <url>: The url of this application.
  • <description>: The description of this application.
  • <copyright>: The copyright of this application.
  • <icon>: The application icon's filename. This file should be relative to the application's Resources directory, or alternatively, can also live under a platform-specific folder, i.e. Resources/iphone or Resources/android.
  • <persistent-wifi>: iOS only.
  • <prerendered-icon>: iOS only.
  • <statusbar-style>: iOS only, style for the status bar
  • <statusbar-hidden>: iOS only, Whether or not the status bar is hidden when the application starts.
  • <fullscreen>: Whether or not the application will start by taking up the entire screen.
  • <navbar-hidden>: Whether or not the navigation bar is hidden for this application
  • <analytics>: Whether or not to automatically collect analytics for this application.
  • <guid>: A unique ID that associates this application for use in analytics


Application properties
tiapp.xml also supports ad-hoc properties that can be used by the application with Titanium.App.Properties. Properties generally follow the form:

<property name="name" type="type">value</property>


  • name is the property name
  • type is the property value's type, valid values are: string, bool, int, double
  • value is the property's value


Properties are also used in specific cases by each platform, which is further explained in each platform section.

iPhone / iOS specific section
Under the top <ti:app> element, you may optionally have an <iphone> element that contains iPhone and iOS specific configuration.

  • <orientations device="device">: Restricts the device to these orientations when the application is running. The value of "device" can be "iphone", or "ipad"
  • <orientation>: An orientation for this <orientations> list, valid values are: Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT, Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT
  • <backgroundModes>: A list of background modes this app supports
  • <mode>: A background mode, valid values are: audio, location, and voip.
  • <requires>: A list of features this app requires
  • <feature>: A feature that this app requires, valid values are: telephony, wifi, sms, still-camera, auto-focus-camera, front-facing-camera, camera-flash, video-camera, accelerometer, gyroscope, location-services, gps, magnetometer, gamekit, microphone, opengles-1, opengles-2, armv6, armv7, peer-peer


Android specific section
Under the top <ti:app> element, you may optionally have an <android> element that contains Android specific configuration. If the application requires any ad-hoc XML from AndroidManifest.xml, make sure to also add the android XML namespace, like so:

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


  • <activities>: Defines a list of custom Javascript based Android activities
  • <activity url="activity.js"/>: Creates an activity with a URL that points to the Javascript file (under Resources) that defines it.
  • Ad-hoc elements: Under the <activity> tag, any ad-hoc element from an AndroidManifest.xml is supported. See the documentation for the activity element in AndroidManifest.xml
  • <services>: Defines a list of custom Javascript based Android services (long running background processes)
  • <service url="service.js" type="standard"/>: Creates a service with a URL that points to the Javascript file (under Resources) that defines it. type is optional.
  • Ad-hoc elements: Under the <service> tag, any ad-hoc element from an AndroidManifest.xml is supported. See the documentation for the service element in AndroidManifest.xml
  • <manifest>: Ad-hoc XML from AndroidManifest.xml
  • <tool-api-level>: The version of the Android API that Titanium builds against. In Titanium Mobile 1.7.0, we default to Android API level 7.


Android specific application properties
Android also supports a number of application properties for various internal settings. (See Application properties above on how to define an application property)

Property NameTypeDefault ValueDescription
ti.android.shake.factordouble1.3shake factor used for the "shake" event in the Titanium.Gesture module
ti.android.shake.quiet.millisecondsint500number of "quiet" milliseconds before the "shake" event is fired
ti.android.shake.active.millisecondsint1000number of "active" milliseconds before the "shake" event is fired
ti.android.google.map.api.key.developmentstringN/AA Google Maps API Key for use in development
ti.android.google.map.api.key.productionstringN/AA Google Maps API Key for use in production
ti.android.httpclient.maxbuffersizeint524288The maximum buffer size (in bytes) before an HTTP response is written to a temporary file instead of memory (default is 512KB)
ti.android.threadstacksizeint16384The stack size (in bytes) to use when creating a Javascript thread (default: 16KB). Bump larger when encountering StackOverflow errors in very large Javascript files
ti.android.compilejsboolN/ATurns on or off JS compilation. By default, JS compilation is only on when distributing an application, but manually setting this to "true" will enable it for development as well.
ti.android.fastdevboolN/AEnables or disables Fastdev. By default, Fastdev is enabled in development mode, and disabled in device and production mode.
ti.android.debugboolfalseturn on detailed logging in the SDK
ti.android.runtimestringv8v8/rhino (since 1.8.0)


The official Android Developers website describes all the other elements that are supported, such as <service>, <uses-permission> and {{<activity> for instance, and these will be added using the same logic.

Common Requirements
Configuring screen densities
To indicate that your application supports any screen densities, which was a common use-case, add the <supports-screens> element set to true like this:

<android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest>
        <supports-screens
            android:smallScreens="false"
            android:normalScreens="true"
            android:largeScreens="true"
            android:anyDensity="false"
        />
    </manifest>
</android>


Enabling the debugger by default
To make the app debuggable by default, set the <application> attribute to `true` (it's false in our default manifest template):

<android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest>
        <application android:debuggable="true" />
    </manifest>
</android>


Setting install location preferences.
Your Android apps are installed by default to the device's internal storage, but Titanium apps can be installed to the SD card using the following configuration:

<android xmlns:android="http://schemas.android.com/apk/res/android">
   <tool-api-level>8</tool-api-level>
   <manifest android:installLocation="preferExternal">
      <uses-sdk android:minSdkVersion="7" />
   </manifest>
</android>


For the <code>android:installLocation</code> property, choose one of these values:
  • android:installLocation="preferExternal" -- specifies that you prefer your app to install to the SD card, but if one isn't present the app can be installed to internal storage.
  • android:installLocation="auto" – specifies that the phone's configuration will determine the installation location. Generally, your app will be installed to internal storage if sufficient space is available. In that case, users could still move your app by opening Settings > Applications > Manage applications, tapping your app, and tapping Move to SD card.
  • android:installLocation="internalOnly" – which specifies that your app cannot be installed to the SD card. See the Android docs for the various reasons why you might choose this option.
  • Finally, you need to add the <uses-sdk> tag within the <manifest> node. This tag specifies that your app requires Google's version 7 or newer APIs — in other words, the phone must be running Android 2.1 Update 1 or newer. That pretty much covers all the newer phones, but will exclude some older devices. On those phones, your app will install to the internal storage.

Properties for configuring the workaround for Google Android issues 2373 and 5277
See TIMOB-4941 and TIMOB-1559 for information about the Titanium workaround to Google issues 2373 and 5277

Property NameTypeDefault ValueDescription
ti.android.bug2373.disableDetectionboolfalsesetting to true will completely disable the workaround
ti.android.bug2373.titleStringRestart Requiredtitle of dialog
ti.android.bug2373.messageStringAn application restart is requiredmessage used in dialog. if skipAlert is true the message is shown in a Toast if message length is > 0
ti.android.bug2373.buttonTextStringContinuebutton text on alert dialog
ti.android.bug2373.restartDelayint500number of milliseconds to wait before starting the new copy of the app with the correct Intent settings.
ti.android.bug2373.finishDelayint0number of milliseconds to wait before finishing (exiting) the current application.
ti.android.bug2373.skipAlertboolfalseif true, the dialog box will not be shown, but the workaround will still be applied if disableDetection is false.


Modules
See the Module Developer Guides for Android and iOS.

timodule.xml
A timodule.xml follows the same structure as a tiapp.xml, but most of the metadata for a module project lives in the module's manifest file. Right now, the timodule.xml is only used in Android, and it supports all of the tags listed in the Android section above. Any custom metadata your Android module defines in it's timodule.xml <android> section will automatically be merged with a Titanium Mobile application that installs your module.

Sample tiapp.xml
Here is a sample tiapp.xml, taken from a generated Titanium Mobile project:

<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
    <id>com.appcelerator.helloWorld</id>
    <name>helloWorld</name>
    <version>1.0</version>
    <publisher>not specified</publisher>
    <url>not specified</url>
    <description>not specified</description>
    <copyright>not specified</copyright>
    <icon>appicon.png</icon>
    <persistent-wifi>false</persistent-wifi>
    <prerendered-icon>false</prerendered-icon>
    <statusbar-style>default</statusbar-style>
    <statusbar-hidden>false</statusbar-hidden>
    <fullscreen>false</fullscreen>
    <navbar-hidden>false</navbar-hidden>
    <analytics>true</analytics>
    <guid></guid>
    <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>
    <android xmlns:android="http://schemas.android.com/apk/res/android">
    </android>
    <modules>
    </modules>
</ti:app>


分享到:
评论

相关推荐

    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd

    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd

    Xposed框架用到 full.xml.gz

    "full.xml.gz"是与Xposed框架相关的配置文件,通常用于在模拟器环境中配置和管理框架的模块。 在Xposed框架中,`full.xml`文件起着至关重要的作用。它是框架的核心配置文件,包含了所有可用模块的信息,包括模块的...

    JAVA web.xml配置详解

    &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;web-app xmlns="http://java.sun....

    关于XML相对路径问题

    如`..//..//..//`进入第四级目录,`..//..//..//xml//test.xml`表示在第四级目录的`dir`文件夹内的`gs.mdb`。 5. **特定文件的相对路径**:`..//Draw//xml//test.xml`这种路径表示当前在`xml`文件夹中,要访问上两...

    Maven archetype-catalog.xml

    官网链接地址:http://repo1.maven.org/maven2/archetype-catalog.xml 百度云链接:https://pan.baidu.com/s/1dF8Qa9V 密码:37me

    maven的settings.xml文件

    ** Maven的`settings.xml`文件详解 ** 在Java开发领域,Maven是一个广泛使用的构建工具,它通过XML配置管理项目的依赖、构建过程以及部署策略。`settings.xml`是Maven的核心配置文件之一,它位于用户的Maven配置...

    webservice启动没有问题,通过自动生成的客户端报错

    {http://xml.apache.org/axis/}stackTrace: AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: java.lang.reflect.InvocationTarget...

    Xposed full.xml.gz

    Xposed框架用到的full.xml.gz,适用于模拟器

    java.lang.NoClassDefFoundError: javax/xml/ws/Service

    jdk升级jdk10后,原本jdk自带的 webservice一些包确实,引起的一系列错误解决方案

    Maven pom.xml与settings.xml详解

    在Maven的世界里,`pom.xml`和`settings.xml`是两个至关重要的配置文件,它们共同决定了Maven项目的构建过程和环境配置。`pom.xml`(Project Object Model)文件是每个Maven项目的核心,它包含了项目的基本信息、...

    RRS地址集合

    - `http://news.chinabyte.com/index.xml`:提供最新的科技新闻更新。 - `http://e.chinabyte.com/index.xml`:专注于电子领域的新闻动态。 - `http://telecom.chinabyte.com/index.xml`:电信行业的新闻资讯。 ...

    在web.xml中引入其他xml配置文件的步骤

    ENTITY test SYSTEM "./classes/test.xml"&gt; ]&gt; ``` 2. **使用实体引用**:在`web.xml`中需要使用该配置的地方,通过实体名称来引用外部文件内容。例如,在`filter`定义中使用`&test;`来插入`test.xml`的内容。 ...

    天气预报API城市代号.xml

    说到开发天气预报,就需要找一个开放接口了,接口有很多,不过个人觉得,中国天气网的数据比较准确,而且也有权威性。...有大神解析了中央气象台返回来的数据,并保存为XML格式,数据具体到县、区级别,供大家参考,

    阿里云镜像的mavensettings.xml配置文件直接替换使用

    3. **直接替换**:根据题目描述,你可以直接将下载的名为"阿里云镜像的mavensettings.xml配置文件直接替换使用"的文件替换现有的`$USER_HOME/.m2/settings.xml`。请注意,替换前请备份原有的`settings.xml`,...

    application.xml配置文件详解

    application.xml配置文件详解 application.xml配置文件详解 application.xml配置文件详解

    web.xml详解.txt

    ### web.xml详解 #### 一、引言 `web.xml`是Java Web应用程序中的核心配置文件,用于定义和管理Web应用的各种配置信息。通过深入理解`web.xml`,开发人员可以更好地控制Web应用的行为和特性,提高编程效率与质量。...

    从中央气象台抓取各地区实时天气

    http://flash.weather.com.cn/wmaps/xml/china.xml 能够获取国内各省及省会城市的天气,可以通过pyName载入各省内城市的天气 如:河北省 pyName="hebei" http://flash.weather.com.cn/wmaps/xml/hebei.xml 就可以...

    jakarta.xml.bind-api-2.3.2-API文档-中文版.zip

    赠送jar包:jakarta.xml.bind-api-2.3.2.jar; 赠送原API文档:jakarta.xml.bind-api-2.3.2-javadoc.jar; 赠送源代码:jakarta.xml.bind-api-2.3.2-sources.jar; 赠送Maven依赖信息文件:jakarta.xml.bind-api-...

    javax.xml.rpc相关jar包

    而`javax.xml.rpc`是Java平台标准版(Java SE)的一部分,它提供了一组API来支持Web服务的开发。这个API集允许开发者创建、部署和调用基于J2EE(Java 2 Platform, Enterprise Edition)的Web服务。 标题中的“javax...

    web.xml配置详解, web.xml web.xml 配置实例

    Web.xml 配置详解 Web.xml 是一个部署描述符文件,用于描述 Web 应用程序的配置信息。该文件是基于 XML 语法的,所有的元素都是大小写敏感的。下面是 web.xml 配置文件的详细解释: 定义头和根元素 在 web.xml ...

Global site tag (gtag.js) - Google Analytics