Hi, I have published ScreenLock Gear into Gear store, which locks screen/bezel/button. I have made web app, because it looks simpler to me, but if there will be no way to do something in web app, I will switch to native, which I'm trying to avoid :)
Now it works simple:
tizen.power.setScreenStateChangeListener(function onScreenStateChanged(prevState, currState) { if (currState === 'SCREEN_NORMAL' && prevState === 'SCREEN_OFF') { tizen.power.turnScreenOff(); tizen.application.launch('zoGfkdrIxZ.ScreenLock');
and
window.addEventListener('tizenhwkey', function(e) { if (e.keyName === "back") { tizen.power.unsetScreenStateChangeListener(); tizen.application.getCurrentApplication().exit();
But it needs some polishing. In this implementation:
1) key listener only monitor BACK key (for exit) when the app is running, not with screen off. This is problem, because it makes the app un-unlockable, until you are really fast.
2) key listener takes it's time to start monitor keys (cca 1 second) so keystrokes in this gap are ignored.
3) The display is turned on for 1/2 sec, before my app (automaticaly suspedned after 40 second by system, which loads watchface automatically) catches event of display change and fires turnScreenOff. I want to get rid of this gap, I want to catch event of button pressed/bezel rotated BEFORE display is sets ON, because it is too late now.
Globally, I'm trying to disable bezel and HW keys with workaround, because it is not possible without platform level certificate. This app is requested by thousands of people.
Thank you for your ideas!