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
laurentC
Posts: 268
Registered: ‎02-05-2010
My Device: Blackberry Z10
Accepted Solution

Share some text on Twitter, Facebook...

Hi,
I would like to share some text wich is inside my app in a TextArea on FaceBook/Twitter/EMail...
I think it's possible with the invocation framework, now in Cascades Beta 2, using an InvokeActionItem inside an actionBar.
Could you help me with an example code please ?
Typically, I would like an actionbar item "Share" and where the user click on it, it opens a popup where he can share the text.
In other words, something similar to Send Menu API in BBOS 7...

Thanks for your help,
Laurent

Twitter : @LaurentKP
My apps
BlackBerry Development Advisor (Retired)
amarcon
Posts: 155
Registered: ‎07-16-2012
My Device: Dev Alpha

Re: Share some text on Twitter, Facebook...

Indeed, there is support for Invocation today but will need to wait for the complete invocation framework to be in place for full documentation; I would suggest you to stay tunned about it on future releases.

Developer
laurentC
Posts: 268
Registered: ‎02-05-2010
My Device: Blackberry Z10

Re: Share some text on Twitter, Facebook...

Any news about the invocation framework now that beta 3 is out ?

 

I need to share some text (coming from a qml component) on Twitter, FaceBook,...

 

The example code in the documentation is not exactly what I need :

 

InvokeActionItem {
    query {
        mimeType: "text/txt"
  uri: "file:///path/to/my/textfile"
  invokeActionId: "bb.action.OPEN"
    }
}
 
Thanks for your help,
Laurent
Twitter : @LaurentKP
My apps
Developer
alupimp
Posts: 22
Registered: ‎03-05-2011
My Device: Not Specified

Re: Share some text on Twitter, Facebook...

this is not a solution, why mark it as one?
Super Contributor
Meghasanghvi
Posts: 306
Registered: ‎08-10-2010
My Device: Not Specified

Re: Share some text on Twitter, Facebook...

Hi,

 

If you want to share text on Twitter,Facebook there is one similar post about sharing text on social media. 

Check out this it may helpful. In that MSohm give the answer for this question.

 

Forum Link :  http://supportforums.blackberry.com/t5/Cascades-Development/sharing-data-of-type-QString-using-Invoc...

 

Inovacation Link: https://developer.blackberry.com/cascades/reference/bb__cascades__invokequery.html#data

 

As per MSohm you have to pass data instead of uri.

 

Feel free to press like button if this helpful to you.

Developer
laurentC
Posts: 268
Registered: ‎02-05-2010
My Device: Blackberry Z10

Re: Share some text on Twitter, Facebook...

[ Edited ]

Sorry but I've read the InvokeActionItem api documentation and I already tried to use data instead of uri but Megha_9_dec and I are facing the same problem :
 "Type mismatch of value of the 'data' property. Expecting QByteArray and found string"

If the code below is not working, how can we share some text in QML ?
InvokeActionItem {
  query { 

    mimeType: "text/txt"
    data:"hello"      
    invokeActionId: "bb.action.SHARE"
   }

 }



thanks for your help,
Laurent

Twitter : @LaurentKP
My apps
Developer
alupimp
Posts: 22
Registered: ‎03-05-2011
My Device: Not Specified

Re: Share some text on Twitter, Facebook...

I tried this:

ActionItem {
            title: "Compartir vía E-mail"
            onTriggered: {
                shareString=titleS + " "
                invoke.trigger("bb.action.SHARE")
            }
            attachedObjects: [
                Invocation {
                    id: invoke
                    query: InvokeQuery {
                        mimeType: "text/txt"
                        data: [shareString]
                        invokeActionId: "bb.action.SHARE"
                    }
                }
            ]
        }

 but the only thing that i achieved is to open a NFC screen, not facebook nor twitter sharing options...

Developer
Ebscer
Posts: 875
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha

Re: Share some text on Twitter, Facebook...

In order to share with Facebook or Twitter you will need to have the Facebook and Twitter apps on your DevAlpha...


Read my thoughts on BlackBerry Development at news.ebscer.com
Developer
alupimp
Posts: 22
Registered: ‎03-05-2011
My Device: Not Specified

Re: Share some text on Twitter, Facebook...

I tried the same on a dev alpha that has facebook, twitter, dropbox, box and email configured, and indeed it does open a native screen that displays those sharing options but when on clicked the text is not passed through passing it through the data property...

Developer
laurentC
Posts: 268
Registered: ‎02-05-2010
My Device: Blackberry Z10

Re: Share some text on Twitter, Facebook...

alupimp I tried your code, I can see the action item to share, but nothing happens when I click on it... Not sure if it's because I'm on the simulator and nothing is installed. Anyway thanks to give us a way of sharing.

 

I don't understand why the api documentation says you need to use the code below :

 

actions: [

  InvokeActionItem {
    ActionBar.placement: ActionBarPlacement.OnBar
    title: "Share"
    query {
    mimeType: "text/txt"
      data: [userConv.text]
      invokeActionId: "bb.action.SHARE"
    }
  }

]

 

I can't even see the action item on the bottom bar this way ?!??

 

I'm beginning to think we can't do that easily in a qml document. Maybe we need to use c++ ???

Twitter : @LaurentKP
My apps