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
smiley
Posts: 1,497
Registered: ‎07-14-2008
My Device: Z10
Accepted Solution

Invoking my app's Card sometimes does not work

In app I have a card setup so that 3rd party apps can invoke it.

It works most of the times but there are sometimes when the invoke is called my app is called but the card never opens.

It will take a couple of tries to get it opened again.

 

anybody have this problem?

Developer
BBSJdev
Posts: 6,116
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: Invoking my app's Card sometimes does not work

I haven't noticed this.

 

Are you seeing it on a particular OS version?

 

I take it you have put a quick console output in the invoke signal to see if it's being called and it's not your code?


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
smiley
Posts: 1,497
Registered: ‎07-14-2008
My Device: Z10

Re: Invoking my app's Card sometimes does not work


BBSJdev wrote:

I haven't noticed this.

 

Are you seeing it on a particular OS version?

 

I take it you have put a quick console output in the invoke signal to see if it's being called and it's not your code?


I'm testing this on the Z10 10.2.1 official version.

 

Both console.  All the codes are excuted but when it comes to display the UI it just crashes.

Sometimes it doesn't even get this far of excuting any code.  It just won't even invoke but after 2 or 3 tries it then works.  Very strange.

Developer
ekke
Posts: 1,568
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: Invoking my app's Card sometimes does not work

CARD invokations should work well

most times if they fail, it's because of pooling

can there be a problem if your app is pooled ?

 

other problems can be workflows like

 

navigation pane -> create page -> do something -> send CardDone

 

next time the same:

if pooled: memory leak because page wasn't destroyed before send cardDone

 

take a look at your code if all is clean when sending back CardDone

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

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner http://vimeo.com/ekkescorner/videos
bb10-development: http://appbus.org Twitter: @ekkescorner
Developer
smiley
Posts: 1,497
Registered: ‎07-14-2008
My Device: Z10

Re: Invoking my app's Card sometimes does not work


ekke wrote:

CARD invokations should work well

most times if they fail, it's because of pooling

can there be a problem if your app is pooled ?

 

other problems can be workflows like

 

navigation pane -> create page -> do something -> send CardDone

 

next time the same:

if pooled: memory leak because page wasn't destroyed before send cardDone

 

take a look at your code if all is clean when sending back CardDone


My assumption is that when the card is closed the screen is freed.  Maybe i'm doin it wrong.

 

my card is setup as in the bar file

 

     <type>card.previewer</type>

 

here is my carddone signal

 

void App::cardDone(const QString& msg) {
    CardDoneMessage message;
    message.setData(msg);
    message.setDataType("text/plain");
    message.setReason(tr("Success!"));

    // Send message
    m_invokeManager->sendCardDone(message);

}

 

when the invoke is call I open the window with the following

 

        qml = QmlDocument::create("asset:///Previewer.qml");
        mywindow = qml->createRootObject<NavigationPane>();
        qml->setContextProperty("_app", this);

        Application::instance()->setScene(mywindow);

so should delete the mywindow in the doneCard slot?

 

in the pooled() i don't have any code.

 

thanks

Developer
smiley
Posts: 1,497
Registered: ‎07-14-2008
My Device: Z10

Re: Invoking my app's Card sometimes does not work

I got this error when i try to invoke my app

 

pushPage : mNavigationStack : ("263")
des.so.1@_ZN2bb8cascades11Application6notifyEP7QObjectP6QEvent+0x20f) mapaddr=001ffdbc. ref=00000008 bdslot=1

don't know what that means.

Developer
ekke
Posts: 1,568
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: Invoking my app's Card sometimes does not work

I'm doing it something different:

 

starting the app in constructor:

 

QmlDocument *qml;
if (mInvokeManager->startupMode()
	== bb::system::ApplicationStartupMode::LaunchApplication
	|| mInvokeManager->startupMode()
	== bb::system::ApplicationStartupMode::InvokeApplication) {
	qml = QmlDocument::create("asset:///main.qml").parent(this);
} else {
	qml = QmlDocument::create("asset:///DataNavPane.qml").parent(this);
}
qml->setContextProperty("app", this);
AbstractPane *root = qml->createRootObject<AbstractPane>();
app->setScene(root);

 then if invoked:

void ApplicationUI::onInvoked(const InvokeRequest& invoke) {
    if (mInvokeManager->startupMode()
	== bb::system::ApplicationStartupMode::InvokeApplication
	|| mInvokeManager->startupMode()
	== bb::system::ApplicationStartupMode::LaunchApplication) {
    QUrl uri = invoke.uri();
    QString path = uri.toLocalFile();
    invokedToImportDataModel(path);
    } else {
	Application::instance()->scene()->setProperty("invokedFromCARD", true);
	Application::instance()->scene()->setProperty("fromEXPRESS",
				invoke.target() == "org.ekkescorner.charts.express");
    }
}

 

ekke

 

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

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner http://vimeo.com/ekkescorner/videos
bb10-development: http://appbus.org Twitter: @ekkescorner
Developer
smiley
Posts: 1,497
Registered: ‎07-14-2008
My Device: Z10

Re: Invoking my app's Card sometimes does not work

i'm doing it similar.  onInvoke I create the qml and display it.

 

I'll keep an eye out and see if I still have this problem.  thanks

Developer
ekke
Posts: 1,568
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: Invoking my app's Card sometimes does not work

I'm creating the qml in ApplicationUI::ApplicationUI - not inside the onIvoke()

that's a difference !

 

I'm having two different entry points:

if app launched or invoked as app, I'm creating a TabbedPane as root with NavigationPanes on top of each Tab

if app is invoked, I'm creating a NavigationPane as root.

 

In onInvoked I'm testing How and from which targetId I was invoked and am doing different things then

 

Cascades can open your app more then one times and can pool the app

if pooled, then the qml wasn't recreated from App constructor AFAIK

so from my POV you way is different and perhaps has a leak ?

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

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner http://vimeo.com/ekkescorner/videos
bb10-development: http://appbus.org Twitter: @ekkescorner
Developer
smiley
Posts: 1,497
Registered: ‎07-14-2008
My Device: Z10

Re: Invoking my app's Card sometimes does not work

here is something interesting I found in my app.

 

I have two screens to handle invoke depending on the data just say screen1 and screen2.

 

When the app is invoked and screen1 is showing.  Say I invoked the app 3 times with screen1 now when I invoke the app to open screen2 I see screen1 displayed for a second and then nothing.  Screen2 doesn't even open and on odd times screen2 opens.

 

I read that the screen is pooled for optimization when it is called again.  Is there a way to force the card to close and open a new instance?

 

I'm opening the screen in the handleInvoke() slot with

 

        qml = QmlDocument::create("asset:///Previewer.qml");
        previewSheet = qml->createRootObject<AbstractPane>();
        qml->setContextProperty("_app", this);
        Application::instance()->setScene(previewSheet);


Even if the screen is pooled I reinit all the vars when invoked.