Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
Posts: 16
Registered: ‎10-08-2013
My Device: Z10
My Carrier: Rogers
Accepted Solution

Webworks and HTTPFilterRegistry on BB10 and BBOS

Hello,

 

  Has anyone been able to register a URL to startup a webworks application on the BB10 platform or BBOS?

 

For example,

 

  If I click on a link in the browser on a BB10 such as

 

childtrac://www.openmyappurl.ca/app_params?param1=myparam 

OR

 http://app.childtrac.ca/app_params?param1=myparam

 

It should open up the childtrac app and the app parses the parameters on the URL to do something.

 

Thanks,

Marc

BlackBerry Development Advisor
Posts: 834
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: Webworks and HTTPFilterRegistry on BB10 and BBOS

This is done with invocation targets now.

 

The basics are shown here in the WebWorks docs:

https://developer.blackberry.com/html5/documentation/rim_invoke-target.html

 

But there is more complete documentation available in the Cascades section. It's applicable to both though because it just gets copied from config.xml into the bar-desriptor.xml file when packaged.

 

https://developer.blackberry.com/native/documentation/cascades/device_platform/invocation/active_tex...

Tim Windsor
Open Source Technical Lead
Developer
Posts: 16
Registered: ‎10-08-2013
My Device: Z10
My Carrier: Rogers

Re: Webworks and HTTPFilterRegistry on BB10 and BBOS

  Thanks for the quick reply.  I've been trying a lot of different combinations and I continue getting an error message "Unable to open childtrac://test" when I enter the following URL in the browser "childtrac://test".

 

Here is a copy of my config.xml file.  Is there a permission missing?

 

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
    xmlns:rim="http://www.blackberry.com/ns/widgets"
    version="1.0.0.0" id="ca.childtrac.app">  
  
    <name>CHILDTRAC</name>
    <author>Marc Regimbal</author>
    <description>CHILDTRAC app description</description>
    <icon src="images/icon.png"/>
    <content src="childtrac.html"/>
    <feature id="community.SmsMessageExt" />
    <feature id="blackberry.invoked" required="true "version="1.0.0.0"/>
    <feature id="blackberry.invoke" required="true" version="1.0.0"/> 
    <feature id="blackberry.invoke.card" />
    <feature id="blackberry.io" required="true" version="1.0.0.0" />
   
    <access uri="*" subdomains="true" />
    <access uri="https://googleapis.com" subdomains="true" />
    <access uri="http://www.childtrac.ca" subdomains="true" />
   
    <rim:smileytongue:ermissions>
       <rim:smileytongue:ermit>access_sms_mms</rim:smileytongue:ermit>
       <rim:smileytongue:ermit>access_pimdomain_messages</rim:smileytongue:ermit>
       <rim:smileytongue:ermit>access_phone</rim:smileytongue:ermit>
    </rim:smileytongue:ermissions>

   <rim:invoke-target id="ca.childtrac.app">
   <rim:invoke-target-type>application</rim:invoke-target-type>
    <filter>
        <action>bb.action.OPEN</action>
        <action>bb.action.VIEW</action>
        <mime-type>*</mime-type>
        <property value="childtrac://" var="uris" />
    </filter>
    </rim:invoke-target>

    <rim:smileysurprised:rientation mode="portrait" />
   
</widget>

 

Is there something wrong in tne config file? 

Developer
Posts: 16
Registered: ‎10-08-2013
My Device: Z10
My Carrier: Rogers

Re: Webworks and HTTPFilterRegistry on BB10 and BBOS

I got it to work!

 

This code in the config.xml works like a charm.

 

<rim:invoke-target id="ca.childtrac.app">
    <type>APPLICATION</type>
    <filter>
        <action>bb.action.OPEN</action>
        <mime-type>*</mime-type>
        <property var="uris" value="childtrac://" />
    </filter>
    </rim:invoke-target>

 

When I click on the following link in the browser, it opens the CHILDTRAC app. 

 

childtrac://locate?l=45.78383&lng=-075.683873.

 

The last piece to solve is the how to get the parameters from the URL in my WebWorks app.  Has anyone been able to do that?

 

Thanks,

Marc.

BlackBerry Development Advisor
Posts: 834
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: Webworks and HTTPFilterRegistry on BB10 and BBOS

That's awesome. So I couldn't get back to you earlier. Check out the invoked sample, or the extended search example in GitHub. Both show how to use the invoked API to capture the data you're given.
Tim Windsor
Open Source Technical Lead
Developer
Posts: 16
Registered: ‎10-08-2013
My Device: Z10
My Carrier: Rogers

Re: Webworks and HTTPFilterRegistry on BB10 and BBOS

Got it to work on BB10.  Haven't tested on BBOS yet.

 

Here is the code you need after implementing the application filter code in your config.xml file.

 

In config.xml

 

<feature id="blackberry.invoked" />

 

 

In Webworks application .js file.

 

function onInvoked(onInvokedInfo) {
  
   if (onInvokedInfo.uri) {
      alert("uri = " + onInvokedInfo.uri);
   }

}

 

blackberry.event.addEventListener("invoked", onInvoked);

 

 

add to HTML test file.

<a href="childtrac://myparameters">click this link to test</a>.

 

Running app will display "childtrac://myparameters" in an alert box.