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

Regular Contributor
Posts: 51
Registered: ‎02-24-2012
My Device: Blackberry Whatever
My Carrier: Ukrtelecom

Run when backgrounded and CPU clock



I have a problem with run_when_backgrounded flag. It looks like that when an app goes to the thumbnail() or invisible() state the BB10 either clocks the CPU down or limits CPU cycles available for an application.


My app needs a lot of CPU power in background sometimes to perform some realtime sound encoding / decoding. It runs fine when foregrounded, but can't encode enough frames in background or thumbnail.


So, there are, actually, two questions:


1. can I request more processing power in thumbnail() or invisible()?

2. can I request the OS to not to turn the screen off so my app won't go to the invisible() state without user interaction?

Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Run when backgrounded and CPU clock

[ Edited ]

For the second question:


#include <bps/screen.h>
int idleMode = settings->getKeepAwake() ? SCREEN_IDLE_MODE_KEEP_AWAKE : SCREEN_IDLE_MODE_NORMAL; screen_window_t handle = Application::instance()->mainWindow()->handle(); screen_set_window_property_iv(handle, SCREEN_PROPERTY_IDLE_MODE, &idleMode);

 Add -lscreen to project file.

Andrey Fidrya, @zmeyc on twitter