Opening Custom Url Schemas with Titanium

Apple’s iOS implements a custom URL scheme is a mechanism through which third-party apps can communicate with each other.  This allows your app to launch other apps.

Using this powerful iOS feature is simple, just provide the app’s url to the Titanium.Platform.openURL method.

List of Custom Url Schemes Resources

The most challenging part of using Custom Url Schemes is finding available url’s to call.  Several new services have been released to meet this need.  Below is a few of the most comprehensive resources I have found.  Unfortunately many of the examples only show the top level Url without detailed functionality mapping.

Custom Url Examples:

Using the Custom Url Scheme resources discussed above you can quickly integrate with a wide variety of services using the same implementation pattern as shown below.  The below  are a few examples showing how you can use custom urls within your Titanium app.

FaceTime:

//Make a facetime call

var url = "facetime://1234567890";
if (Titanium.Platform.canOpenURL(url)) {
    Titanium.Platform.openURL(url);
}
else {
    alert('Cannot open app');
}

iBooks:

//Open an iBook from the App Store

var url = "itms-books://itunes.apple.com/us/book/the-zombie-survival-guide/id419952002";
if (Titanium.Platform.canOpenURL(url)) {
    Titanium.Platform.openURL(url);
}
else {
    alert('Cannot open app');
}

Facebook:

//Open the facebook app to the friends section

var url = "fb://friends";
if (Titanium.Platform.canOpenURL(url)) {
    Titanium.Platform.openURL(url);
}
else {
    alert('Cannot open app');
}

More Resources

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s