Question

I am trying to publish my first application for N9 on Ovi Store but I have failed the QA:

SUMMARY: The application cannot back to front via clicking application icon after suspending the application in background. STEPS TO REPRODUCE: 1. Download and install the content. 2. Launch the application. 3. Suspend the application in background. 4. Click the application icon. ACTUAL RESULT: There is no response when clicking the application icon. EXPECTED RESULT: The application backs to front. Features and controls in the content file must function as specified.

My application is written in C++ with Qt, there is one QWidget. In the main function I am calling

Widget w;
w.showFullScreen();

I also override eventFilter

bool Widget::eventFilter(QObject *object, QEvent *event)
{
    if (event->type() == QEvent::ActivationChange && m_created) {
        if (isActiveWindow()) {
            resume();
        }
        else {
            pause();
        }
    }

    return QWidget::eventFilter(object, event);
}

But when reproducing the bug, I do not get to eventFilter at all. What should I do to get back to my app, when I press the icon?

Was it helpful?

Solution

The correct way to do this is to use applauncherd to launch your app by calling invoker. You could also use its booster feature to improve the startup time of your app (by using MDeclarativeCache).

Here is the documentation on how to use invoker:
http://harmattan-dev.nokia.com/docs/platform-api-reference/showdoc.php?pkn=applauncherd-user-documentation&wb=daily-docs&url=Li94bWwvZGFpbHktZG9jcy9hcHBsYXVuY2hlcmQtdXNlci1kb2N1bWVudGF0aW9u

And here's how to use MDeclarativeCache:
http://harmattan-dev.nokia.com/docs/platform-api-reference/showdoc.php?pkn=applauncherd-mdeclarativecache-documentation&wb=daily-docs&url=Li94bWwvZGFpbHktZG9jcy9hcHBsYXVuY2hlcmQtbWRlY2xhcmF0aXZlY2FjaGUtZG9jdW1lbnRhdGlvbg%3D%3D

OTHER TIPS

After some experiments, I've found the solution. It's a bit weird, but it works:

bool Widget::eventFilter(QObject *object, QEvent *event)
{
    if (event->type() == QEvent::ActivationChange)
    {
        if (isActiveWindow())
        {
            resume();
        }
        else
        {
            pause();
        }
    }
    else if (event->type() == QEvent::SockAct) // pure magic
    {
        activateWindow();
        resume();
    }

    return QWidget::eventFilter(object, event);
}

After pressing the icon on the home screen, filetr QEvent::SockAct and restore application.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top