Protocol handlers and 2-way App integration for iOS.

I recently implemented support in Terminology for the “terminology://” protocol handler. When you register a protocol handler on iOS, you create a way to receive information from other apps, via a URL.  In the case of Terminology, this is used to lookup a word. 

Currently, no other apps support this, but if you have Terminology installed on your iPad or iPhone, you can type in or click on a link like terminology://q=word in Safari and Terminology will launch and lookup that word in it’s dictionary. If the bookmarklet text selection issue in Mobile Safari is fixed, this could get more useful.

I’m interested, however, in providing support for a two way conversation. One of the things I use Terminology for is thesaurus type lookup and substitution. I’d like to be able to send back to a calling app a new word to substitute for the one that was looked up in Terminology and avoid having to cut and paste.

Say you have a note writing app (like PlainText or Elements). You make a text selection, and the note app allows you open a lookup in Terminology — you browse for a synonym, and touch to trigger an action to send that word back to the note app, the note app substitutes it for the text selection.

Initially, I’m imagining this conversation looking something like this (using fictitious app “NoteApp”):

  • NoteApp opens URL terminology://q=[text]&actionId=[UUID]&sourceProtocol=noteapp. The UUID is just a string identifier generate by the app, “text” is the word/string to lookup in Terminology and “sourceProtocol” is a way to tell the target app where to send the result.
  • Terminology launches, displays lookup for “text”. 
  • User may do nothing else, may return to “NoteApp”, may forget about it and go play Angry Birds. Or, the user may find a word they want to substitute, and will click an action that will launch open the URL noteapp://result=[new word]&actionId=[UUID]&sourceProtocol=terminology. The “noteapp://” protocol is based on the “sourceProtocol” passed to Terminology. The “actionId” would match the one sent in the inital request.
  • NoteApp would receive the request, presumably match the actionId to a valid actionId it generated, and determine what, if anything to do about it — hopefully, in this case, substituting the word in the original note.

This is very preliminary, but I thought I’d throw it out there for comment. We need to develop some meaningful ways to allow apps to work with each other and this is my start, based on my very specific need.  I’d love to hear comments regarding the practicality of this sort of very loosely coupled conversation.

UPDATE: Marco has some ideas on this topic. Look for a more detail proposal in the near future.

UPDATE: This idea led to the development of x-callback-url.  Check it out for details.