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
Developer
Sanjit_Patra
Posts: 148
Registered: ‎01-08-2013
My Device: 9860
My Carrier: Airtel
Accepted Solution

Invoke problem in BB10

[ Edited ]

Hi All,

    In my project I have done to invoke webbrowser. There is three buttons with three different URL. But when I click on facebook button it first time does not give any result but second time click it give correct result. then I click on tweeter button it opens facebook URL. Then I click on youtube buttons it opens tweeter URL. I can not understand where my problem.

 

My code is

 

ImageButton {
                id: facebook
                defaultImageSource: "asset:///images/768/mainfacebook_768.png"
                pressedImageSource: "asset:///images/768/mainfacebook_768.png"
                disabledImageSource: "asset:///images/768/mainfacebook_768.png"
                layoutProperties: AbsoluteLayoutProperties {
                    positionX: 538.6
                    positionY: 1213.2
                }
                onClicked: {
                    invokeShare.query.uri = "https://www.facebook.com/";
                    invokeShare.trigger("bb.action.OPEN")
                }
            }
            ImageButton {
                id: twitter
                defaultImageSource: "asset:///images/768/maintwitter_768.png"
                pressedImageSource: "asset:///images/768/maintwitter_768.png"
                disabledImageSource: "asset:///images/768/maintwitter_768.png"
                layoutProperties: AbsoluteLayoutProperties {
                    positionX: 611.5
                    positionY: 1213.7
                }
                onClicked: {
                    invokeShare.query.uri = "https://twitter.com/";
                    invokeShare.trigger("bb.action.OPEN")
                }
            }
            ImageButton {
                id: youtube
                defaultImageSource: "asset:///images/768/mainyoutube_768.png"
                pressedImageSource: "asset:///images/768/mainyoutube_768.png"
                disabledImageSource: "asset:///images/768/mainyoutube_768.png"
                layoutProperties: AbsoluteLayoutProperties {
                    positionX: 689.2
                    positionY: 1214.2
                }
                onClicked: {
                    invokeShare.query.uri = "http://m.youtube.com";
                    invokeShare.trigger("bb.action.OPEN")
                }
            }
          
            attachedObjects: [
                Invocation {
                    //property string videoUrl
                    id: invokeShare
                    query.onUriChanged: {
                        invokeShare.query.updateQuery();
                    }
                    query {
                        mimeType: "text/html"
                        //uri: ""
                        invokeActionId: "bb.action.OPEN"
                    }

                }
            ]

 Please tell me where my problem.

 

Thanks & Regards

          Sanjit

Please use plain text.
New Contributor
man202
Posts: 7
Registered: ‎02-24-2013
My Device: BlackBerry Z10 & Q10
My Carrier: Maxis

Re: Invoke problem in BB10

Hi,

 

You can try my suggested method:

 

 attachedObjects: [
                Invocation {
                    //property string videoUrl
                    id: invokeShare1
                   
                    query: InvokeQuery {
                     mimeType: "text/html"
                     uri: "https://www.facebook.com/"
                     invokeActionId: "bb.action.OPEN"
                   }

                },
                Invocation {
                    //property string videoUrl
                    id: invokeShare2
                   
                    query: InvokeQuery {
                     mimeType: "text/html"
                     uri: "https://twitter.com/"
                     invokeActionId: "bb.action.OPEN"
                   }

                },
                Invocation {
                    //property string videoUrl
                    id: invokeShare3
               
                    query: InvokeQuery {
                     mimeType: "text/html"
                     uri: "http://m.youtube.com"
                     invokeActionId: "bb.action.OPEN"
                   }

                }
            ]

 Then call the invocation objects respectively:

onClicked: {
   invokeShare1.trigger("bb.action.OPEN")
}

 

Regards,

Syam

Please use plain text.
Developer
Sanjit_Patra
Posts: 148
Registered: ‎01-08-2013
My Device: 9860
My Carrier: Airtel

Re: Invoke problem in BB10

Hi man202,

    Your code is static. But my requirement is dynamic. When use list view their is more list this time what will you do?

 

 

 

Please use plain text.
New Contributor
man202
Posts: 7
Registered: ‎02-24-2013
My Device: BlackBerry Z10 & Q10
My Carrier: Maxis

Re: Invoke problem in BB10

Hi Sanjit,

 

You can perform invocation from inside c++ 

 

InvokeManager invokeManager;
InvokeRequest request;
request.setMimeType("text/html");
request.setAction("bb.action.OPEN");


request.setUri(QUrl("YOUR URL HERE"));
InvokeTargetReply *reply = invokeManager.invoke(request);

 

Regards,

Syam

Please use plain text.
Developer
Sanjit_Patra
Posts: 148
Registered: ‎01-08-2013
My Device: 9860
My Carrier: Airtel

Re: Invoke problem in BB10

[ Edited ]

Hi man202,

     Your code is working perfectly.:smileyhappy:

Thanks & Regards

          Sanjit

Please use plain text.