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
Posts: 85
Registered: ‎06-22-2013
My Device: N/A
My Carrier: N/A
Accepted Solution

Share text at FaceBook Or Tweeter

Hi,

 

How can i share some text  at FaceBook or Tweeter.

 

Thanks,

Developer
Posts: 123
Registered: ‎09-18-2013
My Device: Dev Alpha B
My Carrier: BSNL INDIA

Re: Share text at FaceBook Or Tweeter

[ Edited ]

You can use invokation framework to accomplish this, use the following to invoke Facebook app to share text

 

 

https://developer.blackberry.com/native/documentation/cascades/device_platform/invocation/facebook.h...

 

 

Target ID

Facebook

Action

bb.action.SHARE

MIME type text/plain
URI data://
Data Text string to be shared

 

 

twitter:

https://developer.blackberry.com/native/documentation/cascades/device_platform/invocation/twitter.ht...

 

Target ID

Twitter

Action

bb.action.SHARE

MIME type

text/plain

URI

data://

Data

Text string to be shared

 

Please note that all the invocation attributes related to the Twitter/FB app require a Twitter/FB account respectively to be set up on the device. Hope it's clear. Do ask if u need a detailed description on how to do this.

 

[     PLEASE READ : as :   ]

Developer
Posts: 85
Registered: ‎06-22-2013
My Device: N/A
My Carrier: N/A

Re: Share text at FaceBook Or Tweeter

Thanks for the quick reply,

 

i'm using this function, what is wrong with it. 

 

void faceBookShare() 
{
	InvokeRequest request;
	request.setTarget("Facebook");
	request.setAction("bb.action.SHARE");
	request.setMimeType("text/plain");
	request.setUri("http://google.com/");
	m_invokeManager->invoke(request);

}

 

Highlighted
Developer
Posts: 123
Registered: ‎09-18-2013
My Device: Dev Alpha B
My Carrier: BSNL INDIA

Re: Share text at FaceBook Or Tweeter

[ Edited ]
InvokeTargetReply *invokeReply; //AS A GLOBAL VARIABLE

invokeReply = m_invokeManager->invoke(request);

if(invokeReply)
{
invokeReply->setParent(this);
connect(invokeReply, SIGNAL(finished()), this, SLOT(invokeFinished()));
}

 and define the invokeFinished() slot as:

 

void invokeFinished()
{
	switch (invokeReply->error())
	{
	case InvokeReplyError::NoTarget:
		qDebug()<<"Target not found";
		break;
	case InvokeReplyError::BadRequest:
		qDebug()<<"Bad request";
		break;
	case InvokeReplyError::Internal:
		qDebug()<<"Internal error";
		break;
	default:
		qDebug()<<"No errors found, carried out successfully";
		break;
	}

 

tell me what results you get.

 

 

 

BUT DO THIS FIRST.. THIS MIGHT BE THE ERROR..

 

The Uri should be data&colon;//

The data should be what you want to share, encoded into a QByteArray.

 

request.setUri("data&colon;//");
request.setData("Some string, QStrings will work without any typecast");

//PLEASE READ &colon; as :