Codestrong 2012 breakout session how to develop your own modules

42
Introduction to Module Development Aaron K. Saunders Founder/CTO Clearly Innovative Inc @aaronksaunders [email protected]

Transcript of Codestrong 2012 breakout session how to develop your own modules

Page 1: Codestrong 2012 breakout session   how to develop your own modules

Introduction to Module Development

Aaron K. SaundersFounder/CTO

Clearly Innovative Inc@aaronksaunders

[email protected]

Page 2: Codestrong 2012 breakout session   how to develop your own modules

• Founder & CTO Clearly Innovative Inc.• Full stack development for mobile and

web integrations w/javascript & nodejs• Appcelerator Platform Evangelist; Titan• IOS and Android Module Development• 2yrs of Appcelerator blogging • Working on book with ACS and Alloy

Integration

About Me

Page 3: Codestrong 2012 breakout session   how to develop your own modules

What this presentation is about

Page 4: Codestrong 2012 breakout session   how to develop your own modules

• Introduction to module development, not advanced

• Basic integration of third party library and intent based library

• Understand the Titanium Studio Menu commands for scripts

• Understanding Ant build script on Android

Android Topics

Page 5: Codestrong 2012 breakout session   how to develop your own modules

• Introduction to module development, not advanced

• Basic integration of third party library

• Understand the Titanium Studio Menu commands for scripts

• Understanding command line scripts

IOS Topics

Page 6: Codestrong 2012 breakout session   how to develop your own modules

What this presentation is not about

Page 7: Codestrong 2012 breakout session   how to develop your own modules

• Advanced view integration in modules

• Additional information on NDK integration on Android

• Addressing complex third party library conflicts on IOS

Out of Scope

Page 8: Codestrong 2012 breakout session   how to develop your own modules

Android first because it needs some love

Page 9: Codestrong 2012 breakout session   how to develop your own modules

• Instructions on the wiki are your best starting point

• Use the commands provided in Titanium Studio

• Be sure you have followed instructions for setting up Titanium Studio• Installing Java Development Tools

Your Environment

Page 10: Codestrong 2012 breakout session   how to develop your own modules

Android Module Quickly

Page 11: Codestrong 2012 breakout session   how to develop your own modules

• Select “New Titanium Mobile Module Project” from Menu

• Fill out all of the fields presented

• Save the project

• Edit the build.properties to point to the ANDROID_NDK path

• Run project

Create Android

Module

Page 12: Codestrong 2012 breakout session   how to develop your own modules

Run through script on device

Page 13: Codestrong 2012 breakout session   how to develop your own modules

Add some functionality

Page 14: Codestrong 2012 breakout session   how to develop your own modules

Skyhook SDK

Page 15: Codestrong 2012 breakout session   how to develop your own modules

• Import 3rd party library• Pass authentication credentials into

module • Setup callbacks in module• Pass results back from module• Render results

Integration Steps

Page 16: Codestrong 2012 breakout session   how to develop your own modules

• Instantiate the module object

• Create a proxy object

• Provide credentials to module

• Setup success and error callback

• Execute API method on proxy object

Edit app.js

Page 17: Codestrong 2012 breakout session   how to develop your own modules

Edit app.js

Page 18: Codestrong 2012 breakout session   how to develop your own modules

• Remove the template method calls generated by script

• Create property for the username

• Create property for realm

Edit module file

Page 19: Codestrong 2012 breakout session   how to develop your own modules

Edit module file

Page 20: Codestrong 2012 breakout session   how to develop your own modules

• Get properties for username and realm; framework does most of the heavy lifting for you

• Get the callback functions from the passed in parameters

Edit proxy file

Page 21: Codestrong 2012 breakout session   how to develop your own modules

Edit proxy file

Page 22: Codestrong 2012 breakout session   how to develop your own modules

Edit proxy file

Page 23: Codestrong 2012 breakout session   how to develop your own modules

• So now we have all the data in… We need to get the data out

• Create hashMap, add the objects and call our callback

Edit proxy file

Page 24: Codestrong 2012 breakout session   how to develop your own modules
Page 25: Codestrong 2012 breakout session   how to develop your own modules

Code for completed module

Page 26: Codestrong 2012 breakout session   how to develop your own modules

IOS module

Page 27: Codestrong 2012 breakout session   how to develop your own modules

• Instructions on the wiki are your best starting point

• Use the commands provided in Titanium Studio

• Be sure you have followed instructions for setting up Titanium Studio• Installing IOS & Xcode

Development Tools

Your Environment

Page 28: Codestrong 2012 breakout session   how to develop your own modules

Card.io SDK

Page 29: Codestrong 2012 breakout session   how to develop your own modules

• Import 3rd party library• Pass application key into module• Setup callbacks in module• Pass results back from module• Render results

Integration Steps

Page 30: Codestrong 2012 breakout session   how to develop your own modules

Libraries &

Headers

Page 31: Codestrong 2012 breakout session   how to develop your own modules

• Instantiate the module object

• Provide application key to module

• Setup success and error callback

• Execute API method on module

Edit app.js

Page 32: Codestrong 2012 breakout session   how to develop your own modules

Edit app.js

Page 33: Codestrong 2012 breakout session   how to develop your own modules

• Set the interface for the card.io delegate

• Set up private variable for the function callback with success or error information

Edit header file

Page 34: Codestrong 2012 breakout session   how to develop your own modules

Edit header file

Page 35: Codestrong 2012 breakout session   how to develop your own modules

• Remove the template method calls generated by script

• Make sure we de-allocate any memory that we have allocated

• Get the parameters from the javascript passed into objective-c

• Make card.io API call to display card capture information

Edit module file

Page 36: Codestrong 2012 breakout session   how to develop your own modules

Edit module file

Page 37: Codestrong 2012 breakout session   how to develop your own modules

• Handle the response from the UI after it is rendered

• Handle the two delegates from API for user cancel or data entered

• Pass a new hashmap containing results back to the javascript app

Edit module file

Page 38: Codestrong 2012 breakout session   how to develop your own modules

Edit module file

Page 39: Codestrong 2012 breakout session   how to develop your own modules

Edit module file

Page 40: Codestrong 2012 breakout session   how to develop your own modules

OVERLOAD!!

• Blog posting next two weeks

• All code provided on github

• Additional Intent based module included

Page 41: Codestrong 2012 breakout session   how to develop your own modules