O'Reilly logo

Appcelerator Titanium Smartphone App Development Cookbook - Second Edition by Jason Kneen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a public API method

The sample module code that Titanium creates as part of its module creation process provides us with a sample of a public method. We are going to create our own method, however. It will accept a single string input value (the long URL) and then process the short URL via the Bit.ly API before returning it to our Titanium app.

Getting ready…

Before you can use the module, you'll need to sign up for a Bit.ly API key, which you can do for free at https://bitly.com/a/your_api_key.

How to do it…

Open up ComPacktpubBitlyModuleModule.h and ensure that it looks like the following (ignoring the header comments at the top of the file):

#import "TiModule.h"

@interface ComPacktpubBitlyModuleModule : TiModule
{
}

@end

Now, open the

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required