Sorry, but I am new in blackberry 10 development basically I am a Android developer looking for an API in blackberry 10 which prevent my blackberry 10 application to go to sleep mode. I want my screen active forever.
In my application I am using socket communication using QTcpSocket which is not working ones device go to sleep mode.
C++
#include <bb/cascades/Window>
#include <bb/cascades/ScreenIdleMode>
//...
Application::instance()->mainWindow()->setScreenIdleMode(bb::cascades::ScreenIdleMode::KeepAwake);
Or QML
Page {
onCreationCompleted: {
Application.mainWindow.screenIdleMode = ScreenIdleMode.KeepAwake
}
}
I haven't played with TCP
a lot, but I believe it is supposed to work even though the app is minimized, not in foreground or even with screen shutdown, make sure you have the Run as Active Frame
permission checked in your bar-descriptor.xml
file. Many of my apps use UDP
and they work fine even if they aren't in foreground.