If you caught Episode 0.0.8 with Marshall Culpepper, then you already know that Appcelerator Titanium Mobile is a great way for JavaScript developers to write native mobile applications for iOS and Android without needing to learn Objective-C or Java.

However, if you do speak Objective-C or Java you might not know you can extend Titanium and provide JavaScript hooks for your own code that you might want to share with other projects (and even other folks) via custom modules. You can even build extensions in JavaScript as well. The Ti+Plus Modules Starter Pack is a bundle of sample projects demonstrating how to extend Titanium. The source code for these projects augment the iOS module development and Android module development guides on the Titanium documentation site.

Be sure to check out the sample source for Flurry, Paint, and this one from AdMob:

#import "TiAdmobModule.h"
#import "TiBase.h"
#import "TiHost.h"
#import "TiUtils.h"

@implementation TiAdmobModule

// this is generated for your module, please do not change it
-(id)moduleGUID
{
  return @"0d005e93-9980-4739-9e41-fd1129c8ff32";
}

// this is generated for your module, please do not change it
-(NSString*)moduleId
{
  return @"ti.admob";
}

#pragma mark Lifecycle

-(void)startup
{
  // this method is called when the module is first loaded
  // you *must* call the superclass
  [super startup];

  NSLog(@"[INFO] AdMob module loaded",self);
}

-(void)shutdown:(id)sender
{
  // this method is called when the module is being unloaded
  // typically this is during shutdown. make sure you don't do too
  // much processing here or the app will be quit forceably

  // you *must* call the superclass
  [super shutdown:sender];
}

If you’d like to get started with Titanium Mobile, I’ll be joining Kevin and Marshall at Red Dirt Ruby Conf and doing a special Zero-to-App training session to get you up and running with Titanium. We’ll even throw in a little CoffeeScript.


Have comments? Send a tweet to @TheChangelog on Twitter.

Subscribe to The Changelog Weekly – our weekly email covering everything that hits our open source radar.