XCallbackURL

XCallbackURL is a specification to realize App-2-App communication. Please see the official XCallbackURL website for the details.

The goal of the x-callback-url specification is to provide a standardized means for iOS developers to expose and document the methods they make available to other apps. Using x-callback-url’s source apps can launch other apps passing data and context information, and also provide parameters instructing the target app to return data and control back to the source app after executing an action. Specific supported actions will be dependent on the individual apps and will not be discussed in the specification.

Executing a Call

Executing a XCallback is pretty easy. You just need to create a XCallback object and pass in you configuration. The configuration is of the type XCallbackConfiguration and takes the required XCallback parameters as constructor arguments (scheme and action). Additionally, you can add actions parameter, the x-source and others to the configuration. To put this in code, it looks like the snippet below:

XCallbackConfiguration configuration = new XCallbackConfiguration( "scheme", "targetAction" );
configuration.addActionParameter( "foo", "bar" );
XCallback xCallback = new XCallback( configuration );
xCallback.call();

Getting a Callback

When executing the code above you will call another app. Anyway, XCallbackUrl is used to get a call back from the called app. Waiting for a callback is an asynchronous operation. For this reason you need to register a XCallbackListener before you execute the call method. This may look like this:

XCallbackConfiguration configuration = new XCallbackConfiguration( "scheme", "targetAction" );
XCallback xCallback = new XCallback( configuration );
xCallback.addXCallbackListener( new XCallbackAdapter() { ... } );
xCallback.call();

Please note: you do not need to worry about defining the callback parameter because this is done by Tabris for you.