2

Is it possible to register an application to be launched when a specific URL is requested in the browser, email or bbm?

For example I would like when the user clicks on a link flycraft://replay/123 my app to be launched and passed the URI.

Michael Donohue
  • 11,776
  • 5
  • 31
  • 44
HarKal
  • 71
  • 7

3 Answers3

4

This is not possible at the moment.

There are 2 parts to this:

  1. Registration of the URI scheme with the browser. e.g. flycraft:// so that the browser knows to treat these links as invocable.
  2. Registering your app to handle the flycraft:// invocation so that your apps loads.

Unfortunately the first part is not possible at present. There are plans but nothing concrete at this stage.

donturner
  • 17,867
  • 8
  • 59
  • 81
1

Yes! You can do this using the BB10 invocation framework. A fair amount of detail is provided at appurl.org. In short:

  1. Add an invocation target in your bar-descriptor.xml file, if you don't already have one.
  2. Add an target filter to your target, with actions "bb.action.VIEW" and "bb.action.OPEN", and the tag <property var="uris" value="flycraft:"> </property>
  3. Add an invokeManager object to your app's main, and connect its invoked signal to some slot of your code that can handle that request.
fiddlemath
  • 101
  • 1
  • 7
1

The way to do this on BlackBerry 10 is by adding the code below in your bar descriptor file:

<invoke-target id="eu.nlogn.flycraftplaybook.replayview">
<invoke-target-type>application</invoke-target-type>
    <filter>
        <action>bb.action.VIEW</action>
        <mime-type>*</mime-type>
        <property value="flycraft://" var="uris" />
    </filter>
</invoke-target>

then you should listen for the NAVIGATOR_INVOKE_TARGET event and handle it like this:

const navigator_invoke_invocation_t *invoke = navigator_invoke_event_get_invocation(event);

if (invoke) {
    // retrieve invocation action
    const char *action = navigator_invoke_invocation_get_action(invoke); 
const char *uri = navigator_invoke_invocation_get_uri(invoke);  

if (action && uri) {
        // handle the uri you got
    }
} else {
    fprintf(stderr, "Error retrieving invocation: %s\n", navigator_event_get_err(event));                               
}

Unfortunately there is no way to do this on the Playbook.

HarKal
  • 71
  • 7