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
Highlighted
Developer
Posts: 102
Registered: ‎06-03-2012
My Device: Playbook
My Carrier: *

Sharing a PNG image file only shows "BBM Group"

Hi guys,

 

I'm trying to share a PNG image file from C++. The problem is, I'm only getting the option to share via "BBM Group". I was hoping to get "BBM", "NFC", etc. as well.

 

Using QML code I get the desired result, but using C++ not. And I need to use C++ for that.

 

    QString path = QDir::current().absoluteFilePath("data/wallpaper.png");

    bb::system::InvokeRequest request;
    request.setMimeType("image/png");
    request.setAction("bb.action.SHARE");
    request.setUri(QUrl::fromLocalFile(path));
    bb::system::InvokeTargetReply *reply = m_invokeManager.invoke(request);

 

-----------
http://kodira.de
BB Apps: Pattern :: Plonk
BlackBerry Development Advisor
Posts: 15,885
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Sharing a PNG image file only shows "BBM Group"

The code you have triggers an unbound invocation, which means it'll just open using the first application it finds.  If you want to allow the user to select from a list of applications you can do something like this:

 

void BBMInvocation::shareImageBound()
{

	QString path = QDir::current().absoluteFilePath("shared/photos/avatar.png");

	m_pInvocation = Invocation::create(
			InvokeQuery::create().parent(this).mimeType("image/png").uri(
					QUrl::fromLocalFile(path)));

	QObject::connect(m_pInvocation, SIGNAL(armed()), this, SLOT(onArmed()));

	QObject::connect(m_pInvocation, SIGNAL(finished()), m_pInvocation,
			SLOT(deleteLater()));

}

void BBMInvocation::onArmed()
{
	m_pInvocation->trigger("bb.action.SHARE");
}

 

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Developer
Posts: 676
Registered: ‎05-06-2012
My Device: Dev Alpha & PlayBook
My Carrier: wifi

Re: Sharing a PNG image file only shows "BBM Group"

Trying to replicate this and getting back the following error

'm_pInvocation' was not declared in this
scope

on the line with "m_pInvocation = Invocation::create"

Any idea what I might be doing wrong?
_________________________________________________________
co-founder of Diaree | BB Dev for PictureThis
Developer
Posts: 271
Registered: ‎05-29-2013
My Device: BlackBerry Z10
My Carrier: MTS

Re: Sharing a PNG image file only shows "BBM Group"

m_pInvocation is a class private member with type Invocation *
You can give this variable another name and declare it elsewhere.
-------------------------------------------------------------------------------
NSR Reader for BlackBerry 10 @NSRReader on Twitter
Me @xelfium on Twitter