The AmbientJS middleware is specifically designed to be used with the cross-platform mobile development framework Titanium. The middleware can be used to more easily build cross- platform mobile applications that communicate with each other over a mobile ad-hoc network. Before introducing the AmbientJS middleware, we focus on the Titanium framework itself. This documentation provides a quick start to Titanium and is intended for programmers that don’t have any experience with the cross-platform development framework.
The Titanium development framework allows for the development of cross-platform mobile applications. The framework is able to generate native mobile applications for different mobile platforms from a single code base written in JavaScript. Titanium provides support for the deployment of applications on mobile platforms like iOS, Android and BlackBerry.
Using the Titanium development framework, programmers only require web development skills to build truly native mobile applications for all popular mobile platforms. This greatly reduces the development and maintenance costs of these native mobile applications, since one single code base is used to generate the different mobile applications. The generation of native mobile applications instead of web applications also allows programmers to maintain a native feel with a complete, native graphical user interface and also allows to distribute the mobile apps via the dedicated distribution platforms like the App Store and Google Play Store.
In order to generate a native mobile application from a code base written in JavaScript, Titanium translates the JavaScript code to compiled native code, producing a native container application with a native graphical user interface. To run the application logic, the native container internally uses a JavaScript Interpreter that interprets all dynamic JavaScript code.
Now we will describe how to set up the Titanium Studio and how to build your first cross- platform mobile application. The Titanium Studio is a powerful Eclipse-based IDE in which programmers can develop cross-platform mobile applications and from which these mobile applications can be deployed on the mobile devices.
Before being able to download the Titanium Studio, an Appcelerator Network account has to be created. An Appcelerator Network account can be created here. After activating the created account via the validation mail, navigate to the Resources page. Here, the appropriate Titanium Studio installer can be downloaded.
To install Titanium Studio on Windows, the windows installer has to be downloaded and executed. This installer will also install Java runtime, Node.js and Git as they are used by the development framework.
To install Titanium Studio on Mac OS X, the DMG application packages has to be downloaded. After mounting the application package, the Titanium Studio folder has to be dragged to the Applications folder.
The first time the Titanium Studio is launched, the user has to select a workspace, i.e. a folder where all projects and preferences of the IDE will be stored. After selecting the workspace, the user also has to provide the login credentials of his previously created account. These credentials only have to be provided the first time Titanium Studio is used.
In order to be able to develop native mobile applications for several mobile platforms, the Titanium Studio requires the appropriate SDKs and tools for these different mobile platforms. The first time the Titanium Studio is launched, a platform configuration dialog opens. This platform configuration dialog gives an overview of the already installed SDKs and enables users to install the missing SDKs.
In the screenshot below, the platform configuration dialog indicates that only the SDK for the iOS platform is already installed. If the programmer wants to be able to deploy the cross- platform mobile application on Android too, the Android SDK has to be checked. The installation configuration can be changed by modifying the Settings. After clicking Configure Titanium will start the installation process.
Note that the SDK for the iOS mobile platform can only be used when Titanium Studio is running on a Mac, as it relies on XCode to generate the native iOS applications.
After installing the Titanium Studio and the required SDKs for the different mobile platforms, it is possible to create cross-platform mobile application. As in the original Eclipse IDE, first a new project has to be created, which can selected in the menu bar File > New > Mobile App Project.
After selecting the wizard for creating a new Mobile App Project, a project template can be chosen for the newly created project. For a single window mobile application, click on the Classic category and select the template Single Window Applicaton, as can be seen below.
When continuing setting up the new project, the programmer has to provide a project name and App ID. Here, the programmer also has to specify on which platform he wants to be able to deploy the mobile application.
Titanium Studio will now create a new project with the given properties. These application specific properties can be found and changed in the tiapp.xml file at the root of the project folder.
The project folder of a newly created project consists of two folders and a tiapp.xml file. As mentioned before, this tiapp.xml file holds the configuration and all properties of the current mobile application project.
The i18n folder (internationalization) holds the strings.xml files, which specify the different strings for the corresponding languages.
The Resources folder holds all other resources of this mobile application. These resources include all images for the mobile applications, the javascript code for the graphical user interface (in the ui folder) and the application logic (the app.js file).
Now that a new cross-platform mobile application has been created, it can be deployed on several mobile platforms. Titanium allows developers to run the developed mobile applications on real devices or in a target simulator.
To run the mobile application, the project has to be selected in the project explorer. Then select to run the current project and on which mobile platform you want to run the application.
It is possible to select any simulator of the mobile platform for which the SDK is installed. Devices connected to the computer can also be selected from the dropdown menu. Press the run-icon to perform the selected operation.
Note that when a mobile application is run on a physical Android device, the mobile application will start automatically. However, when running the mobile application on a physical iOS device, the mobile application is only installed on the device. For security reasons, the mobile application has to be started manually with the mobile device.
It is possible to import some of the sample projects provided by Titanium. These small and simple sample projects can greatly help developers to build large cross-platform mobile applications.
Any documentation of the APIs found in Titanium can be found on their website.
This documentation is based on the official quickstart-guide of Titanium.