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
Developer
lew
Posts: 174
Registered: ‎03-05-2009
My Device: Dev Alpha
My Carrier: -
Accepted Solution

detect when invoked card has been closed

I'm looking for a signal that will help me identify when an invoked card has been closed (back button pressed)...

 

for example, i invoked the sys.mediaplayer.previewer card, and would like to detect when this card is closed on when the user is back on its previous screen...

 

i mention 'closed' mostly instead of back as if you use the mediaplayer card, it will automatically close/back itself once the video is done playing.

 

onTopChanged didn't get called :smileysad:

 

anyone know of a way to to that?

Please use plain text.
Developer
kylefowler
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Re: detect when invoked card has been closed

connect(invokeManager, SIGNAL(childCardDone(const bb::system::CardDoneMessage&)), this, SLOT(onCardDone(const bb::system::CardDoneMessage&)));

 

Like all of my posts
Please use plain text.
Developer
Developer
lew
Posts: 174
Registered: ‎03-05-2009
My Device: Dev Alpha
My Carrier: -

Re: detect when invoked card has been closed

that works with a small issue: it doesn't provide the target that has completed :smileysad: 

i fixed that by storing the targetId when i invoke a card

 

thanks!

Please use plain text.
New Contributor
Kevin2020
Posts: 6
Registered: ‎01-24-2013
My Device: 10
My Carrier: 10

Re: detect when invoked card has been closed

hi, I want to invoke setting screen as a card . Can I do this in qml.
Please use plain text.
Contributor
paul_shah
Posts: 17
Registered: ‎02-01-2013
My Device: Bold 9900
My Carrier: Bell

Re: detect when invoked card has been closed

Once I connect this, how can I check what response the card gave? For example, for the camera card, there are three responses that are given by the card for different "reasons". What is the code to check for these "reasons"?

 

Here is the link: http://developer.blackberry.com/cascades/documentation/device_platform/invocation/camera.html

Please use plain text.
Developer
Zmey
Posts: 1,507
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: detect when invoked card has been closed

[ Edited ]

I think it can be accessed using reason function of CardDoneMessage class. More details:

 

"Listen for card message response" section on this page:

http://developer.blackberry.com/cascades/documentation/device_platform/invocation/card_invocation.ht...

 

CardDoneMessage:

http://developer.blackberry.com/cascades/reference/bb__system__carddonemessage.html#function-reason


Andrey Fidrya, @zmeyc on twitter
Please use plain text.
Contributor
paul_shah
Posts: 17
Registered: ‎02-01-2013
My Device: Bold 9900
My Carrier: Bell

Re: detect when invoked card has been closed

connect(invokeManager, SIGNAL(childCardDone(const bb::system::CardDoneMessage&)),
this,
SLOT(childCardDone(const bb::system::CardDoneMessage&)));
 
void App::childCardDone(const bb::system::CardDoneMessage &message)
{
    if (message.reason() == "done")
              // do something 
}
 
If I try to do that, it gives me an error. Am I doing something wrong? "done" is one of the reasons given by the camera card. 
Please use plain text.
Contributor
paul_shah
Posts: 17
Registered: ‎02-01-2013
My Device: Bold 9900
My Carrier: Bell

Re: detect when invoked card has been closed

Nevermind! I just forgot to include #include <bb/system/CardDoneMessage>. Haha. Thanks for the reply Zmey!! :smileyhappy:

Please use plain text.
Developer
Zmey
Posts: 1,507
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: detect when invoked card has been closed

[ Edited ]

Does it compile? Try logging the values:
qDebug() << message.reason() << "\n";
qDebug() << message.dataType() << "\n";
qDebug() << message.data() << "\n";

 

upd: Glad to hear it's working :smileyhappy:

 


Andrey Fidrya, @zmeyc on twitter
Please use plain text.
BlackBerry Development Advisor
shaque
Posts: 227
Registered: ‎07-14-2008
My Device: Not Specified

Re: detect when invoked card has been closed

You will get this signal when a card is closed/done.

 

void childCardDone (const bb::system::CardDoneMessage &message)

Please use plain text.