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
AVPTI
Posts: 64
Registered: ‎06-28-2011
My Device: BlackBerry Z10
My Carrier: Bell

Invoking Twitter profile

Hi,

 

I am unable to invoke my Twitter profile when clicking the image I have.

 

ImageView {
                        imageSource: "asset:///images/twitter.png"
                        verticalAlignment: VerticalAlignment.Top
                        horizontalAlignment: HorizontalAlignment.Center
                        onTouch: {
                            twitter.trigger("bb.action.VIEW")
                        }
                    }

attachedObjects: [
                        
                        Invocation {
                            id: twitter
                            query: InvokeQuery {
                                id: tweet
                                invokeActionId: "bb.action.VIEW"
                                onQueryChanged: tweet.updateQuery()
                                uri: "twitter:connect:avptix"
                                invokeTargetId: "com.twitter.urihandler"
                            }
                        }
                    ]

 

Please use plain text.
Administrator
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: Invoking Twitter profile

[ Edited ]

Can you describe the error message(s) you are seeing?

 

What version of the BlackBerry 10 OS and device/simulator model are you testing on?  If you are testing on 10.2, I wanted to share we are tracking the following defect where invocation https://www.blackberry.com/jira/browse/BBTEN-1765 does not work as expected when using targeted InvokeActionItem. 

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Please use plain text.
Developer
Ebscer
Posts: 858
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha
My Carrier: Verizon

Re: Invoking Twitter profile

I vaguely recall there being an issue with trying to do this in qml, try doing this from c++ instead. The following code works for me

 

void App::invokeTwitter()
{
	bb::system::InvokeManager* m_invokeManager;
	m_invokeManager = new InvokeManager(this);
	InvokeRequest request;
	request.setTarget("com.twitter.urihandler");
	request.setAction("bb.action.VIEW");
	request.setUri("twitter:connect:ebscer");
	m_invokeManager->invoke(request);
}

 


Read my thoughts on BlackBerry Development at news.ebscer.com
Please use plain text.
BlackBerry Development Advisor
shaque
Posts: 231
Registered: ‎07-14-2008
My Device: Not Specified

Re: Invoking Twitter profile


Ebscer wrote:

I vaguely recall there being an issue with trying to do this in qml, try doing this from c++ instead. The following code works for me

 

void App::invokeTwitter()
{
	bb::system::InvokeManager* m_invokeManager;
	m_invokeManager = new InvokeManager(this);
	InvokeRequest request;
	request.setTarget("com.twitter.urihandler");
	request.setAction("bb.action.VIEW");
	request.setUri("twitter:connect:ebscer");
	m_invokeManager->invoke(request);
}

 


Bound invocations are broken via QML InvokeQuery APIs. The quoted suggestion above is the only workaround at this time, i.e. use the core C++ invokemanager APIs to perform bound invocations. Unbound invocations are not affected. 

 

Cheers.

Shadid

Please use plain text.
New Developer
alinet
Posts: 9
Registered: ‎04-30-2013
My Device: Z10
My Carrier: Bell

Re: Invoking Twitter profile

sorry for the noob question , how can I call it in QML I mean like "_inovkeTwitter" or what?
lets start by making a nice looking app !!
Please use plain text.
Developer
Ebscer
Posts: 858
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha
My Carrier: Verizon

Re: Invoking Twitter profile


alinet wrote:
sorry for the noob question , how can I call it in QML I mean like "_inovkeTwitter" or what?

When intiializing the app in C++ use the following code

QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
qml->setContextProperty("App", this);

AbstractPane *root = qml->createRootObject<AbstractPane>();
app->setScene(root);

 Then in your QML you can call the method by using 

 

App.invokeTwitter()

 


Read my thoughts on BlackBerry Development at news.ebscer.com
Please use plain text.
New Developer
alinet
Posts: 9
Registered: ‎04-30-2013
My Device: Z10
My Carrier: Bell

Re: Invoking Twitter profile

thanks for the help
lets start by making a nice looking app !!
Please use plain text.
New Developer
alinet
Posts: 9
Registered: ‎04-30-2013
My Device: Z10
My Carrier: Bell

Re: Invoking Twitter profile

one more thing where does this part go ?

void App::invokeTwitter()
{
bb::system::InvokeManager* m_invokeManager;
m_invokeManager = new InvokeManager(this);
InvokeRequest request;
request.setTarget("com.twitter.urihandler");
request.setAction("bb.action.VIEW");
request.setUri("twitter:connect:ebscer");
m_invokeManager->invoke(request);
}

into main.cpp or should I include it in a seprate .cpp file ?
lets start by making a nice looking app !!
Please use plain text.
Developer
knobtviker
Posts: 127
Registered: ‎05-31-2013
My Device: BlackBerry Z10 Limited Edition
My Carrier: Bonbon

Re: Invoking Twitter profile

So has bounding invocation been fixed in 10.3 finally?

Please use plain text.