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
Developer
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers
Accepted Solution

Invocation from c++

Since the QML method of share invocations is currently broken (purposely or otherwise) I'm left with c++ 

 

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");
}

 

found a few samples & this one is most relevant to what i need but it when i try to declare the invocation in my .hpp i get 

'Invocation' does not name a type

private:
    Invocation* m_pInvocation;

 I've included in my .cpp

#include <bb/cascades/Invocation>
#include <bb/cascades/InvokeQuery>

 

 

 

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Invocation from c++

In .hpp add before class declaration:

namespace bb { namespace cascades { class Invocation; } }

The declaration should look like this:

private:
bb::cascades::Invocation *m_pInvocation;

Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: Invocation from c++

Thanks Zmey, its working perfectly now..... still odd that the qml method freezes the app, i'm going to file a issue report on it

Developer
Posts: 669
Registered: ‎02-19-2011
My Device: BlackBerry PlayBook 32GB
My Carrier: Sprint

Re: Invocation from c++

Would you mind posting both the cpp and the hpp? I can't figure it out and I need this as well...

Staff UI Prototyper (read: full-time hacker)


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

Developer
Posts: 669
Registered: ‎02-19-2011
My Device: BlackBerry PlayBook 32GB
My Carrier: Sprint

Re: Invocation from c++

Nevermind! I got it to work as well.

This post was Godsent for me. I spent all night last night trying to get sharing to work with QML. This code did the job. Awesome!!!

Staff UI Prototyper (read: full-time hacker)


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

Developer
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: Invocation from c++

Glad its working for you too, i've been puzzling over the QML part for over a week & when you mentioned c++ yesterday i figured that was the best we'd get Smiley Wink

 

I only found the invocation method in this post & with Zmey's help got it patched together

 

... I did file an issue on the QML side not working as it should 

 

https://www.blackberry.com/jira/browse/BBTEN-874