Getting Started with Appcelerator Titanium Mobile
Here’s a quick list of steps to get you started with Appcelerator Titanium Mobile. Following them should help you avoid some common pitfalls (well, the ones I fell into at least!)
- Make sure you have and can run an Android emulator. http://developer.android.com/sdk/index.html If you’re on a Mac, also install the latest iOS and XCode SDK from http://developer.apple.com
- Download Titanium from http://appcelerator.com
- The first time you run Titanium, it should ask you to log in then download the latest version of Titanium Mobile. It does this because Titanium lets you build mobile and desktop apps. In our case, we’re building mobile.
- After Titanium downloads the latest Titanium Mobile release, change to the “Profile” perspective (top left, looks like a single guy). Update the information in here, and set the directory where you installed your Android SDK. Mine is “/Users/dawson/android-sdk-mac_86/” (notice that I did not do android-sdk-mac_86/tools”). Click “Save Profile”.
- Switch back to the “Projects” perspective (top left, looks like a briefcase).
- Click “New Project”, and use the following for the fields:
- Project Type: Mobile - Name: MyFirstMobileApp - App Id: com.yourname.myfirstmobileapp - Directory: the directory you want your project to be in. This is case sensitive, so be careful! - Company/Personal URL: your website's URL, or some random website - Titanium SDK version: 1.4.2 - Installed Mobile Platforms: There should be a green checkmark next to "Android SDK Found". If not, go back and verify steps 1 and 3 were done properly. - Click “Create Project”, and your project will be created. Make sure it works by clicking the “Test & Package” tab, then the “Run Emulator” tab, and then the “Launch” button.
- The emulator should launch, and you should see a simple app with two tabs.
- Now let’s edit your app. Titanium doesn’t include an IDE, so open up your favorite editor, and look in the directory you created your app in. There will now be a “Resources” folder, and in that a “app.js” file. App.js is the entry point to your application, so open it first and take a look.
- Look at the API online and grow your application to what you need it to do. https://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI-module
If you want, I have released a library to make using Titanium easier and a bit more jQuery like. It’s available here, and includes a test project to demonstrate most of what it does for you: https://github.com/dawsontoth/Appcelerator-Titanium-Redux
Let me know how it goes. There are a lot of steps, but I was pretty verbose. You should fly through it, but if you get tripped up, just comment me. Titanium tends to trip up on some really simple things that are easy to get past if you know what to look for, but you can waste a lot of time if you haven’t been through it before.
Regards,
Dawson