11-23-2012 03:32 PM
I am trying to build a native extension for WebWorks (BB10) to control screen timeout for my app.
Ideally I'd like to set a longer timeout when my app is in foreground, without affecting the timeout settings of the device itself. I can see SCREEN_PROPERTY_IDLE_TIMEOUT in <screen.h>, which I hope could be used for this purpose.
If that is not possible, the other approach would be to set the screen to SCREEN_IDLE_MODE_KEEP_AWAKE and back to SCREEN_IDLE_MODE_NORMAL based on timing controlled by the JavaScript code.
I got as far as
(a) getting memoryJnext sample work in my app and
(b) finding screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_IDLE_MODE, &idle_mode) code snippet.
The question is how do I assign WebWorks app windows context to screen_win?
Solved! Go to Solution.
12-15-2012 06:34 PM
12-17-2012 11:10 PM
I've been looking for a solution too. The main problem seems to be that when you are thrown into the middle of a WebWorks extension, you don't have any handle to a screen_window_t. So the native core API seems to be a dead end. On the other hand, the Cascades API has a static Application::instance() that seems to offer a path to the window API we need. So I found this API, and the IDE seems to be happy to compile it, but I don't have an extension set up to test it. Please do tell me if this works:
bb::cascades::Application::instance()->mainWindow(
01-24-2013 03:50 PM
We've been working on this in Dev Rel too. The challenge is getting access to the WebWorks screen as you've found. Unfortunately, we can't use the Cascades API in WebWorks, only Qt, C++ and C APIs work. We tried a few things already that didn't work, and are continuing to investigate some other options.
01-31-2013 06:19 PM
We figured it out.
Extension is now live here: https://github.com/blackberry/WebWorks-Community-A
02-06-2013 09:31 PM
That's great! Thanks for providing a way to handle what would sometimes be a crippling limitation in WebWorks. Of course, since the BB10 emulator does not seem to sleep at all, I will just have to take your word for it that this works :-)