51
Getting started with Titanium - Next-Generation Mobile Platform

Getting started with Appcelerator Titanium

Embed Size (px)

DESCRIPTION

Techday7, Cross platform application development using Appcelerator Titanium event's Getting started with Appcelerator Titanium By Naga Harish M, Lead Developer of Anubavam Technologies

Citation preview

Page 1: Getting started with Appcelerator Titanium

Getting started with Titanium

- Next-Generation Mobile Platform

Page 2: Getting started with Appcelerator Titanium

About Me…

• Naga Harish• AnuBaVam is my company• Appcelerator Titanium certified developer

• My Blog : ShareOurIdeas.com• @nagaharishmovva

Page 3: Getting started with Appcelerator Titanium

Our Application

UI API Phone API

Bridge - JavaScript -Java / JavaScript - Objective C

OS - Android / iPhone

Native Android App Native iOS App

Optional Modules

Titanium MobileApplication Source Files

Page 4: Getting started with Appcelerator Titanium

JS files to native objective code

• JS is statically analyzed• Ti’s Python build scripts interact with native SDK

tools .• Native project stub will created• JS precompiled to bytecode(Android) or inlined

in a generated C file(iOS)• Your JS and native code package together with

V8/Rhino or JavaScriptCore to interpret JS code at runtime

Page 5: Getting started with Appcelerator Titanium

• PC or Mac machine (for iOS development)• XCode with iOS SDK• Android SDK• Titanium Studio with SDK

To start development…

Page 6: Getting started with Appcelerator Titanium

• Powerful Eclipse-based IDE• It will help you create, run for test and deploy

(to app store)

Small intro about Titanium Studio…

Page 7: Getting started with Appcelerator Titanium

• It always notifies you about latest SDK and Studio updates .

Ti Studio (why it so powerful)…

Page 8: Getting started with Appcelerator Titanium

• It is so smart, because it catches mistakes immediately!

Ti Studio (why it so powerful)…

Page 9: Getting started with Appcelerator Titanium

• Syntax highlighting

Ti Studio (why it so powerful)…

Page 10: Getting started with Appcelerator Titanium

• Content assist and more…

Ti Studio (why it so powerful)…

Page 11: Getting started with Appcelerator Titanium

Project structure…

Page 12: Getting started with Appcelerator Titanium

LET’S GET INTO THE INTERESTING PART. CODING…

Page 13: Getting started with Appcelerator Titanium

Create Window

We can also set properties like thiswin.backgroundColor="#F00";win.setBackgroundColor("#F00");

Page 14: Getting started with Appcelerator Titanium

Create Label

Page 15: Getting started with Appcelerator Titanium

Create Button

LET’S GUESS…

Page 16: Getting started with Appcelerator Titanium

Create Button

Page 17: Getting started with Appcelerator Titanium

Create button with add event listener

Page 18: Getting started with Appcelerator Titanium

Add sub view to Window or View

Page 19: Getting started with Appcelerator Titanium

Log methods

Page 20: Getting started with Appcelerator Titanium

Animate with UI elementsBefore start

After complete

Page 21: Getting started with Appcelerator Titanium

HELLO WORLDEvery software engineer’s first program

IDECreate new projectFolder structureBuild folderError handling (@ runtime)Include JS file

Page 22: Getting started with Appcelerator Titanium

Connect to Web Services

open( “GET|POST”, “[HTTP://URL…]”, “[TRUE|FLASE – async call]”] )This async parameter only for iOS

Page 23: Getting started with Appcelerator Titanium

Connect to Web Services

• How to send data using post method?

• How to stop request

Page 24: Getting started with Appcelerator Titanium

REQUEST.OPEN(“SHOW”,”DEMO”)Keep your app fresh. Use web services

Page 25: Getting started with Appcelerator Titanium

• Install will copy SQLite database file to device's internal storage. If file is there, it just uses the open method

• We can use Ti.App.Properties to set db install to true. For E.g. Ti.App.Properties. setBool(‘isDbInstalled’,true)

• Open will automatically open the DB to perform CRUD operations

Database

Page 26: Getting started with Appcelerator Titanium

Database code snippets

• Running SQL Queries against the DB

• We can also get number of Rows affected

Page 27: Getting started with Appcelerator Titanium

• What about SELECT Query?

Database code snippets

Page 28: Getting started with Appcelerator Titanium

DATABASE.OPEN(“DEMO”)CRUD operations

Page 29: Getting started with Appcelerator Titanium

• Create 2 letter folder inside “i18n” (18 stands for the number of letters between the first i and last n in internationalization) in root folder.

• Create Locale folder in it• In that Locale folder just keep strings.xml

Internationalization

http://bit.ly/TiLang

Page 30: Getting started with Appcelerator Titanium

• strings.xml

Our App in different languages

http://bit.ly/TiLang

Page 31: Getting started with Appcelerator Titanium

私のアプリケーション今すぐデモ ...

Page 32: Getting started with Appcelerator Titanium

• Just like CSS, we can use this JSS to bring rich user interface to apply styles to elements.

• Yes, here also we can create “Class” and “ID”. Just like .classname or #Idname

• How to include JSS in our view?– Just retain same name for the .JSS file– For Example :- ui.js and the JSS file ui.jss

Applying Styles using JSS

Page 33: Getting started with Appcelerator Titanium

CSS and JSS

#idName{ color:#f00; height:100px; width:100px;}

#idname{ color:#f00; height:100; width:100; text:”This is my CSS Text”;}

.className{backgroundColor:#fff;}

.className{ backgroundColor:#fff;}

Page 34: Getting started with Appcelerator Titanium

JSS {DEMO:’NOW’}Let’s apply style

Page 35: Getting started with Appcelerator Titanium

• Create a server backed for your app instantly• Launch and scale your app automatically• No server coding or administration required• Reduced Cost

Cloud Service

Page 36: Getting started with Appcelerator Titanium

• Standard(Tier 1)– Users– Key Values– Photos– Custom objects– Email Templates– Push notifications

• Advanced(Tier 2)– Chat– Check-ins– Social integration– Photo Collections– Clients– Places– Status– Ratings, Reviews & Likes– Posts

Cloud Service (cont)

http://bit.ly/TiCloud http://bit.ly/TiCloudBook

Page 37: Getting started with Appcelerator Titanium

Cloud Service (cont)

http://bit.ly/TiCloud http://bit.ly/TiCloudBook

Page 38: Getting started with Appcelerator Titanium

Cloud Service (cont)

http://bit.ly/TiCloud http://bit.ly/TiCloudBook

Page 39: Getting started with Appcelerator Titanium

Cloud Service (cont)

http://bit.ly/TiCloud http://bit.ly/TiCloudBook

Page 40: Getting started with Appcelerator Titanium

Cloud Service (cont)

http://bit.ly/TiCloud http://bit.ly/TiCloudBook

Page 41: Getting started with Appcelerator Titanium

Cloud Service (cont)

http://bit.ly/TiCloud http://bit.ly/TiCloudBook

https://api.cloud.appcelerator.com/v1/users/create.json?key=[Key Value]

Page 42: Getting started with Appcelerator Titanium

• We can also create a Module atop Titanium using native code (Objective C or Java)

• We can get more Free/$ modules from the marketplace

• You can also contribute!

Extend Ti API

http://bit.ly/TiMarket

Page 43: Getting started with Appcelerator Titanium

Useful Ti Modules

Page 44: Getting started with Appcelerator Titanium

• Ti for Titanium• L for Titanium.Locale.getString• alert for Titanium.UI.createAlertDialog• And also remember about Code snippets– For e.g. :- button then {ctrl + space} and see the

magic..

Macro

Page 45: Getting started with Appcelerator Titanium

File system

Few more code snippets

Page 46: Getting started with Appcelerator Titanium

Few more code snippets (cont)…

Page 47: Getting started with Appcelerator Titanium

Few more code snippets (cont)…

iOS

Android

Page 48: Getting started with Appcelerator Titanium

To know more….http://bit.ly/TiMyPage http://bit.ly/TiVimeo http://bit.ly/TiCloud

http://bit.ly/TiLearninghttp://bit.ly/TiTutorial http://bit.ly/Ti7Days

Page 49: Getting started with Appcelerator Titanium

To know more (code github)….

• https://github.com/appcelerator• https://github.com/appcelerator-developer-relations • https://github.com/BradBroulik/titanium-mvc• https://github.com/tanin47/silver• https://github.com/railskarthi/

acs_custom_object_query• https://github.com/railskarthi/acs_android_push• https://github.com/guilhermechapiewski/titanium-

jasmine/

Page 50: Getting started with Appcelerator Titanium

http://bit.ly/TiURLs

Page 51: Getting started with Appcelerator Titanium

Thank You

Naga Harish MShareOurIdeas.com