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
Aleurs
Posts: 97
Registered: ‎04-01-2014
My Device: BlackBerry10 Simulator

Help with Invocation

Okay,

 

I posted now two times about my problem without getting any solution. I think I reached an impasse and describing what I did and wanted to achieve was a little confusing and with too less details.

 

So now I just want to describe in the easiest way, what I want to do. Maybe someone can help me out here.

 

The Code I used is from here: https://developer.blackberry.com/native/documentation/cascades/device_platform/invocation/receiving_...

 

Here are the important parts:

int main(int argc, char *argv[])
{
    InvokeManager invokeManager;

    bool connectResult;
     
    Q_UNUSED(connectResult);
     
    connectResult = QObject::connect(&invokeManager,
    SIGNAL(invoked(const bb::system::InvokeRequest&)),
    &myApp, SLOT(onInvoke(const bb::system::InvokeRequest&)));
     
    // This is only available in Debug builds.
    Q_ASSERT(connectResult);

    return app.exec();
}
 
// This is the slot that gets called when the invoke signal is emitted
void MyApp::onInvoke(const bb::system::InvokeRequest& invoke)
{
    // Handle the invocation
}

When invoking my app (from e.g. the filebrowser) the following steps are performed:

 

1. getting the uri (path to the file to open)

2. give it to a C++-function which opens the file, reads its content binary (strings) and fills the strings into C++-objects (when an error occures while reading the file the function returns false, otherwise true)

If the file was read in without errors:

2.1 creates a Page in a C++-Function where the strings are filled into

2.2 initiates a PreviewerUI where the content of the file is displayed.

When an error occurs while reading in the file:

??????????

 

Here is my problem. What to do when the function returns false (ergo the file couldn't be read in completely).

 

When I do nothing in this case the following happens. When I click a file in the filebrowser the screen goes dark for opening the file. But then nothing happens (okay I didn't tell the app to do something so this is normal). But the problem is with this darkened screen I can't click on any other file in the filebrowser again. To use the filebrowser again I have to slide a finger from bottem to the top of the screen. And then I see the active frame of the filebrowser and then I can close it again and reopen it.

 

It gets more problematic when I open a file from an e-mail attachment. Again the screen goes dark for the invocation. Then the error occurs. And then the screen stays dark. So I can't open another mail. And since I can't close the BB-Hub I can't open another mail until I restart the Blackberry.

 

I hope you can understand what my problem is. Any idea how I can solve this problem?