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

Native Development

Reply
New Developer
Posts: 6
Registered: ‎03-03-2014
My Device: BlackBerry Z10
My Carrier: Bell
Accepted Solution

"Open in Browser" and "Share" Problem

Hi all,

 

Working on my first app. I have it mostly finished, but I can't for the life of me figure out how to get the invocations working.

 

The app loads an arbitrary URL, found in variable detailView.url, in a WebView. This is working fine. However, I can't seem to pass detailView.url on to an Invocation to open in a Browser or Share. If I output detailView.url to the console, it gives me the correct URL.

 

This is what I have so far:

 

               attachedObjects: [
                    Invocation
                    {
                        id: invokeBrowser
                        query: InvokeQuery
                        {
                            mimeType: "text/html"
                            invokeActionId: "bb.action.OPEN"
                        }
                    }
                ]
                
                actions: [
                    ActionItem {
                        title: "Open in Browser"
                        imageSource: "asset:///images/ic_open.png"
                        ActionBar.placement: ActionBarPlacement.OnBar
                        onTriggered: {
                            invokeBrowser.query.uri = detailView.url;
                            console.log(detailView.url);
                            invokeBrowser.trigger("bb.action.OPEN");
                        }
                    }
                ]
            }

 

 

In the console it gives me the following error:

 

InvocationWrapper::onQueryFinished: no matching result from Menu Service for query
   mimeType="text/html"
   uri=QUrl("") 
   data= "" 
   metadata= QMap() 
   perimeter= 0 
   action= "bb.action.OPEN" 
   target= "" 
   invokerIncluded= false 

 

I've been trying to figure this out for a few days now and just can't seem to wrap my head around it. Does anyone have any suggestions?

Thanks!

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: "Open in Browser" and "Share" Problem

I suggest using an InvokeActionItem instead, here's an example I have of changing the data within the invocation I'm sure you can adapt it for your code...

 

{
    [ ... ]

    actions: [
        InvokeActionItem {
            id: iaiBrowser
            title: "Invoke Browser"
            query.invokeActionId: "bb.action.OPEN"
            query.invokeTargetId: "sys.browser"
            query.uri: "http://www.stok.biz"
        }
    ]

    onCreationCompleted: {
        iaiBrowser.query.uri = "http://www.google.com"
    }

    [ ... ]

}

 


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
New Developer
Posts: 6
Registered: ‎03-03-2014
My Device: BlackBerry Z10
My Carrier: Bell

Re: "Open in Browser" and "Share" Problem

Thanks very much for your reply BBSJdev! I was able to get it working with this suggestion.

Cheers!