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
TheMarco
Posts: 669
Registered: ‎02-19-2011
My Carrier: Sprint
Accepted Solution

Invoking share card

Is there an example anywhere like the WebWorks 'Share Targets' one but for Cascades?

 

This is the example:

 

https://github.com/blackberry/BB10-WebWorks-Samples/tree/master/ShareTargets

 

I want to do this in a Cascades app but I'm not sure how. I saw a Facebook share example but I would like to pull up the share card so people can share something to any channel of their choice.

 

Any ideas?

Staff UI Prototyper (read: full-time hacker)


My BB10 apps: Screamager | Scientific RPN Calculator | The Last Weather App

Please use plain text.
Developer
slashkyle
Posts: 766
Registered: ‎10-16-2012
My Carrier: Telus

Re: Invoking share card

this does it but onArmed is causing the share card to launch as soon as the app is started

 

Button {                  
   attachedObjects: [
                         Invocation {
                             id: invoke
                                 query: InvokeQuery {
                                 id: invokeQuery
                                 mimeType: "text/plain"
                                 }
                             onArmed: {
                                 invoke.trigger("bb.action.SHARE");
                                 }
                                 }
                                 
                             ]
                    
                    onClicked:{
                        invokeQuery.data = myTextArea.text;
                        invokeQuery.updateQuery();
                        }

 

Please use plain text.
Trusted Contributor
AllSystemGo
Posts: 140
Registered: ‎11-23-2010
My Carrier: Rogers

Re: Invoking share card

This is what I'm using to invoke the share card

 

        contextActions: [
            ActionSet {
                actions: [
                    InvokeActionItem {
                        title: "Share"
                        query {
                            mimeType: "text/plain"
                            invokeActionId: "bb.action.SHARE"
                        }
                        onTriggered: {
                            data = "This the text that is going to be shared"
                        }
                    }
                ]
            }
        ]

 

here is a great example on that : http://www.bbcascades.com/index.php/tutorial-list/47-invoke-share-card?highlight=YToxOntpOjA7czo1OiJ...

 

Hope it helps

Please use plain text.
Developer
slashkyle
Posts: 766
Registered: ‎10-16-2012
My Carrier: Telus

Re: Invoking share card

[ Edited ]

is it possible to use the InvokeActionItem outside of context actions or a pre-defined menu(in a button or label)... that was how i was using it previously but I wanted to be able to instantly open the menu which required me to create my own, now that's done the reason i did it, doesnt work heh

Please use plain text.
Developer
TheMarco
Posts: 669
Registered: ‎02-19-2011
My Carrier: Sprint

Re: Invoking share card

Unfortunately none of these work for me.

 

The first one launches the card immediately (not desired) and the second one uses ActionItems. I don't have those. The invocation is supposed to happen when the user taps a button I defined...

 

Starting to wonder if this can be done in QML at all or whether I need C++?

Staff UI Prototyper (read: full-time hacker)


My BB10 apps: Screamager | Scientific RPN Calculator | The Last Weather App

Please use plain text.
Trusted Contributor
AllSystemGo
Posts: 140
Registered: ‎11-23-2010
My Carrier: Rogers

Re: Invoking share card

I think C++ is going to be your only bet right now. I tried a couple of different stuff on a button but didn't make it happen.
Please use plain text.
Developer
TheMarco
Posts: 669
Registered: ‎02-19-2011
My Carrier: Sprint

Re: Invoking share card

Yeah it seems so. I just tried this which seems to make sense to me but... it crashes the app when tapping the button.

 

            Button {
                horizontalAlignment: HorizontalAlignment.Center
                attachedObjects: [
                    Invocation {
                        id: invoke
                        query {
                            mimeType: "text/plain"
                            onQueryChanged: invoke.query.updateQuery()
                        }
                    }
                ]
                onClicked: {
                    invoke.query.data = "This is it" + lastValue;
                    invoke.trigger("bb.action.SHARE");
                }
                text: qsTr("Send answer")
            }

 

Staff UI Prototyper (read: full-time hacker)


My BB10 apps: Screamager | Scientific RPN Calculator | The Last Weather App

Please use plain text.
Developer
TheMarco
Posts: 669
Registered: ‎02-19-2011
My Carrier: Sprint

Re: Invoking share card

I got it to work with C++. Since this wasn't exactly easy for me I decided to write down what I did in a little tutorial for others to hopefully help.

 

https://forrst.com/posts/Adding_Social_Sharing_through_Invocation_to_your-Fmz

Staff UI Prototyper (read: full-time hacker)


My BB10 apps: Screamager | Scientific RPN Calculator | The Last Weather App

Please use plain text.
Trusted Contributor
AllSystemGo
Posts: 140
Registered: ‎11-23-2010
My Carrier: Rogers

Re: Invoking share card

Nice tutorial. 

 

Thank you for sharing.

Please use plain text.
Developer
jmoukel
Posts: 111
Registered: ‎07-05-2012
My Carrier: MOvistar

Re: Invoking share card

great help!
Please use plain text.