nativeblackberry-10blackberry-playbook

Launching a BB10 application by clicking a link in the browser or email


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.


Solution

  • 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.