Top Banner
Extending Titanium With Native Modules
22

Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015

Jul 16, 2015

Download

Technology

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015

Extending Titanium With

Native Modules

Page 2: Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015

Boydlee

PollentineCEO, Tipsy & Tumbler

Ltdwww.tipsyandtumbler.co.uk

Founder of “tiConf”

Twitter: @boydleep

Twitter: @ticonf

Page 3: Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015

What is a “module”?

A packaged module is a module that can

contain native code, JavaScript, or both.

Page 4: Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015

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

Page 5: Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015

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)

Page 6: Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015

(1) Providing a feature that

doesn’t exist

Document Scanner

Page 7: Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015
Page 8: Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015

(2) Integration with existing

native libraries

Wikitude Augmented Reality

Page 9: Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015
Page 10: Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015

(3) When you need low-level

code control

Video Playback via Brightcove

Page 11: Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015
Page 12: Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015

(4) Providing an existing

feature in a different way

Custom Native Maps

via MapBox

Page 13: Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015
Page 14: Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015

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!

Page 15: Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015
Page 16: Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015

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

Page 17: Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015
Page 18: Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015

Sharing is caring

Page 19: Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015

The Appcelerator

Marketplace has

both free and paid

modules

http://marketplace.appcelerator

.com

Page 20: Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015
Page 21: Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015

GitHub is a great place to

find open-source

modules

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

Follow twitter accounts like

@gitnotified

Page 22: Extending Titanium with Native Modules - tiConf Bangladesh - Dhaka 2015

Thank you.