Codestrong 2012 breakout session how to develop your own modules
-
Upload
appcelerator-inc -
Category
Documents
-
view
1.032 -
download
5
Transcript of Codestrong 2012 breakout session how to develop your own modules
Introduction to Module Development
Aaron K. SaundersFounder/CTO
Clearly Innovative Inc@aaronksaunders
• 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
What this presentation is about
• 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
• 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
What this presentation is not about
• Advanced view integration in modules
• Additional information on NDK integration on Android
• Addressing complex third party library conflicts on IOS
Out of Scope
Android first because it needs some love
• 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
Android Module Quickly
• 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
Run through script on device
Add some functionality
Skyhook SDK
• Import 3rd party library• Pass authentication credentials into
module • Setup callbacks in module• Pass results back from module• Render results
Integration Steps
• 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
Edit app.js
• Remove the template method calls generated by script
• Create property for the username
• Create property for realm
Edit module file
Edit module file
• 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
Edit proxy file
Edit proxy file
• 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
Code for completed module
IOS module
• 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
Card.io SDK
• Import 3rd party library• Pass application key into module• Setup callbacks in module• Pass results back from module• Render results
Integration Steps
Libraries &
Headers
• Instantiate the module object
• Provide application key to module
• Setup success and error callback
• Execute API method on module
Edit app.js
Edit app.js
• Set the interface for the card.io delegate
• Set up private variable for the function callback with success or error information
Edit header file
Edit header file
• 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
Edit module file
• 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
Edit module file
Edit module file
OVERLOAD!!
• Blog posting next two weeks
• All code provided on github
• Additional Intent based module included
Aaron K. Saunders@aaronksaunders