How to get the device lock status in an app?

asked 2019-05-12 13:15:08 +0300

jsommer gravatar image

I'm working on a system overlay feature, that must not be shown, if the device is locked and the lock screen is shown. How can I retrieve this status inside my app?

edit retag flag offensive close delete

Comments

just choose correct layer for your overlay

coderus ( 2019-05-12 15:59:43 +0300 )edit

@coderus Thanks. I think this is the relevant code snipped:

overlayView = SailfishApp::createView();
QObject::connect(overlayView->engine(), SIGNAL(quit()), qGuiApp, SLOT(quit()));
overlayView->setTitle("MyApp");
overlayView->rootContext()->setContextProperty("viewHelper", this);
....
overlayView->setSource(SailfishApp::pathTo("qml/overlay.qml"));
overlayView->create();
QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface();
native->setWindowProperty(overlayView->handle(), QLatin1String("CATEGORY"), "notification");
...
overlayView->show();

The layer seems to be the notification layer in this case, correct? Can you suggest another one under the lock screen?

jsommer ( 2019-05-18 17:58:26 +0300 )edit