Invoking apps using active text

You can add custom active text elements that invoke your app by registering string patterns and app targets. A custom active text element for your app is specified using a URI in your app's config.xml file. You must also specify your app as the invocation target. The pattern and target parameters in the invocation request are registered with the BlackBerry 10 OS when the app is installed on the device.

On devices that use BlackBerry Balance, the app with the active text and the app being invoked must be in the same space (personal or work).

To use a URI pattern, you specify the start of a URI. You can specify the scheme portion alone (for example, myuri:) or you can specify a longer form (for example, myuri:createid). Strings in native UI controls become active text elements if they start with this pattern, conform to the syntax of a URI, and an invocation filter is specified, as described below. In BlackBerry WebWorks applications, you must specify text patterns within an anchor element.

Patterns are specified in the config.xml file using the <invoke-target> element. Here's an example that shows an invocation request that contains a URI pattern:

<invoke-target id="com.mycompany.myapplication">
    <type>APPLICATION</type>

    <filter>
      <action>bb.action.VIEW</action>
      <mime-type>*</mime-type>
      <property var="uris" value="activetext:"/>
    </filter>

    <invoke-target-pattern>      
      <pattern-value type="uri">activetext:</pattern-value>    
    </invoke-target-pattern>

</invoke-target>

Attribute Description

<invoke-target>

The invocation parameters of your app. For more information about <invoke-target>, see Target declaration.

<type>

Can be APPLICATION or CARD.

<filter>

Describes the criteria for this app to be considered for unbound invocations or invocation queries. Must be specified for URI pattern types only. For the URI pattern type, apps must be invokable with bb.action.OPEN or bb.action.VIEW. For more information about <filter>, see Target filters.

<invoke-target-pattern> and <pattern-value>

The string pattern to match. Use type="uri" for URI matching.

To link to an active text target from a WebWorks app, add an anchor tag to your HTML source.

<a href="activetext://test">Active Text Link</a>

To get the value of an active text invocation, check the uri property in the invoked callback.

document.addEventListener('invoked', function (args) {
    console.log(args.uri);
});

Last modified: 2014-12-04



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus