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: 1,636
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido

Re: Push Notification in Blackberry Hub

When I select Open from the Hub it launches my app but how do I connect the notification/request to my app so that it knows it has been called?

 

Is there a signal to connect the Notification or request?

 

Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: Push Notification in Blackberry Hub


smiley wrote:

When I select Open from the Hub it launches my app but how do I connect the notification/request to my app so that it knows it has been called?

 

Is there a signal to connect the Notification or request?

 


this is easy done

	// we can be invoked as an app from notification in HUB
	bool ok = connect(mInvokeManager,
			SIGNAL(invoked(const bb::system::InvokeRequest&)), this,
			SLOT(handleInvoke(const bb::system::InvokeRequest&)));
	if (!ok) {
		qDebug() << "connect handleInvoke failed";
	}

 and then handle this

void EkkesTeaTimer::handleInvoke(const InvokeRequest& request) {
	// do your stuff here, you have access to the request:
	qDebug() << "Invoke Request";
	qDebug() << "Invoke Request Action:" << request.action();
	qDebug() << "Invoke Request Mime:" << request.mimeType();
	qDebug() << "Invoke Request URI:" << request.uri();
	qDebug() << "Invoke Request Data&colon;" << request.data();
}

 

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 1,636
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido

Re: Push Notification in Blackberry Hub

[ Edited ]

thanks but how do I use mInvokeManager?

 

update:  Figured it out.  I had to create an instance of the InvokeManager.

 

thanks

Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: Push Notification in Blackberry Hub


smiley wrote:

thanks but how do I use mInvokeManager?

 

update:  Figured it out.  I had to create an instance of the InvokeManager.

 

thanks


yep

I'm declaring it in .hpp

bb::system::InvokeManager *mInvokeManager;

 and in .cpp constructor I initialize

EkkesTeaTimer::EkkesTeaTimer(bb::cascades::Application *app)
: QObject(app), mInvokeManager(new InvokeManager(this))

 if you're doing some stuff with InvocationFramework you should only use one instance of InvokeManager

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner