Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015

22
Extending Titanium With Native Modules

Transcript of Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015

Extending Titanium With

Native Modules

Boydlee

PollentineCEO, Tipsy & Tumbler

Ltdwww.tipsyandtumbler.co.uk

Founder of “tiConf”

Twitter: @boydleep

Twitter: @ticonf

What is a “module”?

A packaged module is a module that can

contain native code, JavaScript, or both.

It is built, or packaged, for a specific platform (e.g.

you may have an ‘iOS only’ module)

“Native” modules are those built and packaged using

native languages, such as Java for Android or

Objective-C for iOS.

Interacts directly with native libraries and exposes a

proxy wrapper for a native object - for example

Ti.UI.Button is a proxy object for the native button

control on both iOS and Android.

Native Modules

When you want to provide a feature

that doesn’t exist in the standard

framework

When you want to integrate existing

native libraries

When you need low-level code

control (e.g. video chat)

When you want to provide an

existing feature in a different way

(e.g. maps)

(1) Providing a feature that

doesn’t exist

Document Scanner

(2) Integration with existing

native libraries

Wikitude Augmented Reality

(3) When you need low-level

code control

Video Playback via Brightcove

(4) Providing an existing

feature in a different way

Custom Native Maps

via MapBox

Define the functionality you want exposed in

the module via native code: think of it as the

module’s “API”

Create a new module project via the CLI or

Titanium Studio

Build and Test!

Import the module into your Titanium Project

Reference the module in your code by

“requiring” it

Use the native module features with

JavaScript - just like any normal Titanium UI

control or feature

Sharing is caring

The Appcelerator

Marketplace has

both free and paid

modules

http://marketplace.appcelerator

.com

GitHub is a great place to

find open-source

modules

https://github.com/search?q=titanium

Follow twitter accounts like

@gitnotified

Thank you.