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
Super Contributor
Posts: 440
Registered: ‎01-13-2011
My Device: Playbook
My Carrier: NA

Invoke my app even though it is open

I have my 'on invoked' code in a class in my app. The app loads an on invoked message when invoked from another app.

 

The problem is, when I invoke the app, and the app is already open, nothing happens, it loads the app, but it doesnt display the correct on invoked message.

 

It works fine when the app is closed.

 

How can I get the message to be displayed even if the app is open?

--------------------------------------------------------------------------------------------------
BlackBerry Apps: Instruments | ARTPAD | Piano | Drums | Xylophone
Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Invoke my app even though it is open

[ Edited ]

Hi,

 

Have you subscribed to InvokeManager's invoke signal after constructing the application instance?

Was the connection successful and is the slot being called?

 

Can you please paste the code where InvokeManager is being setup, and also onInvoke slot definition/implementation & signal connect line?

 

This page has an example, but you've probably already seen it:

http://developer.blackberry.com/cascades/documentation/device_platform/invocation/receiving_invocati...


Andrey Fidrya, @zmeyc on twitter
Super Contributor
Posts: 440
Registered: ‎01-13-2011
My Device: Playbook
My Carrier: NA

Re: Invoke my app even though it is open

Hi,

 

Yes I have looked at the page. I think my problem is that my invoke code is on one of my classes and not in main.

 

I have tried to put it in main:

 

Q_DECL_EXPORT int main(int argc, char **argv)
{
    qInstallMsgHandler(myMessageOutput);
    // this is where the server is started etc
    Application app(argc, argv);

    // localization support
    QTranslator translator;
    QString locale_string = QLocale().name();
    QString filename = QString( "Drums_%1" ).arg( locale_string );
    if (translator.load(filename, "app/native/qm")) {
        app.installTranslator( &translator );
    }

    Drums mainApp;

    //INVOKE
    InvokeManager invokeManager;
    QObject::connect(invokeManager, SIGNAL(invoked(const bb::system::InvokeRequest&),&app, SLOT(onInvoke(const bb::system::InvokeRequest&));

  return Application::exec();
    // when loop is exited the Application deletes the scene which deletes all its children (per qt rules for children)
}

 

My slot:

 

void onInvoke(const bb::system::InvokeRequest& invoke)
{
    // Handle the invocation
}

 But I get 2 errors:

 

- Macro usage error for macro: SIGNAL

- Syntax error

 

for the line:

QObject::connect(invokeManager, SIGNAL(invoked(const bb::system::InvokeRequest&),&app, SLOT(onInvoke(const bb::system::InvokeRequest&));

 

--------------------------------------------------------------------------------------------------
BlackBerry Apps: Instruments | ARTPAD | Piano | Drums | Xylophone
Highlighted
Retired
Posts: 249
Registered: ‎07-14-2008
My Device: Not Specified

Re: Invoke my app even though it is open

Can you please paste the lines your compiler is printing in the console for these errors?

 

Shadid