AnujAroshA
AnujAroshA

Reputation: 4811

run_when_backgrounded and invisible() state in BlackBerry 10

I'm implementing a BlackBerry 10 Cascade application. It uses a QTimer class and has the following code.

connect(timer, SIGNAL(timeout()), this, SLOT(update()));

This is working and calling to update() function according to the given time period. It works when the application in foreground (application takes the entire screen) and also when the application is running as an active frame (application is in thumbnail state).

I have given following permission also in bar-descriptor.xml.

<permission>run_when_backgrounded</permission>

But when a user press the cross mark (☓) the whole process stop. According to the BB10 Cascade Documentation

When an app has permission to run in the background, there is no Stopped state

What I want to know,

1.) Is there a way that we can programmatically eliminate the cross mark (☓) when it is in active frame ?

If Not

2.) How can I run a QTimer even if the application is stopped? Simply How can I run a background process without a UI when my cascade app is stopped.

3.) Is it enough providing run_when_backgrounded permission in the bar-descriptor.xml to run an application in background?

In the same documentation page under Managing application states, there is invisible() state. But the example given there cannot implement in a cascade application class which include following

#include <bb/cascades/Application>

Is that only for #include <bb/Application> ?

Upvotes: 2

Views: 560

Answers (1)

Marc Plano-Lesay
Marc Plano-Lesay

Reputation: 6958

What you want is an headless app. You'll find anything you need here. Basically, you have two modes: event-based (your app will be launched to react to an event like an incoming SMS), or always running. Always running apps will need BlackBerry approval.

Note that the headless apps are not yet supported. They are introduced in the 10.2 SDK, which has been released as gold yesterday. You'll need a 10.2 OS too (which has not been deployed yet, except test, stripped down versions) to use them.

The invisible state you're talking about concerns non-headless apps: an application is considered visible if it's on foreground, invisible if it's in active frame state, or if there's another app in front of it.

Upvotes: 3

Related Questions