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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Regular Contributor
Posts: 54
Registered: ‎07-15-2010
My Device: Not Specified
Accepted Solution

Invokation framework. Problem sharing simple text

Hello,

 

I would like to have an option to share simple text on my application. For this I'm using this code in my .QML file:

 

ActionItem {
     attachedObjects: [
          Invocation {
               id: invoke
               query: InvokeQuery {
                    id: invokeQuery
                    mimeType: "text/plain"
                    data: "This is a text text"
               }
          }
     ]
     
     title: qsTr("Share")
     imageSource: "asset:///images/share.png"
     ActionBar.placement: ActionBarPlacement.OnBar
     onTriggered: {
          invoke.trigger("bb.action.SHARE")
     }
}

 With the text above I can see the hardcoded text appear in all the applications I can share it to (the bold line), however, if I use the following line to change the text dynamically for the current element of the List instead I get nothing. No text is shared at all:

 

data: ListItemData.description

 Did anybody was able to successfully share a plain dynamic text?

 

Thanks,

Highlighted
Regular Contributor
Posts: 54
Registered: ‎07-15-2010
My Device: Not Specified

Re: Invokation framework. Problem sharing simple text

Well, I managed to get a solution, but I had to use C++ instead of QML. Here you have it, just in case any of you have the same problem:

 

void MyApp::share(QString name, QString surname, QString age)
{
     printf("Share invoked");

     m_pInvocation = Invocation::create(
          InvokeQuery::create()
	       .parent(this)
	       .mimeType("text/plain")
	       .data(name.toUtf8() + surname.toUtf8() + age.toUtf8()));
	  QObject::connect(m_pInvocation, SIGNAL(armed()),
	    this, SLOT(onArmed()));
	  QObject::connect(m_pInvocation, SIGNAL(finished()),
	    m_pInvocation, SLOT(deleteLater()));
}

// Declare the following method as SLOT on your .hpp file
void MyApp::onArmed() {
	m_pInvocation->trigger("bb.action.SHARE");
}