Hotkeys

Hi,

it is possible to set hot keys for several functionalities, like for example activating flash light on long press of "select/enter"-button. The handling here can not be deactivated in an app. Regardless whether I return "false" in "onKeyPressed/onKeyReleased" the flashlight gets activated. Is this behavior expected one? Is there any other way to deactivate hot key functionality in an app when I want to handle long press on a button by myself?

Thanks!

Bye
  • There's no way to deactivate the hotkeys, as their purpose is to provide a quick way to get to things no matter what's running on the watch. Some devices have configurable hotkeys, while others have a specific thing attached to one or more - Like the 645M, where a long press of down brings up the music control.
  • Hi Jim,

    thanks for your answer!

    I was assuming that hotkeys are more or less for watchfaces, where other input is anyways not possible. It was not clear for me that those are also triggered in apps/widgets. Funny thing is, that in my case, where I am trying to handle long key presses, both behaviors are triggered. Means the function associated with the corresponding hotkey but also my functionality. But as this is expected behavior as it seems, people simply need to deactivate hotkey for the select-key in my app.

    Thanks!

    Bye
  • Former Member
    Former Member
    Api don't support that action. But you can do action with query key group. just like : Esc->Esc (quit) Esc->Up (page flip) Esc->Enter (do sth). Just do what you want.
  • Former Member
    Former Member
    watchfaces can't control any key. widget can only use enter key. Those watch os limit.
  • What do you mean by "key group"? Multiple key simultanously?

    Bye
  • Former Member
    Former Member
    What do you mean by "key group"? Multiple key simultanously?

    Bye


    Not that. You can store the key press sequence in to array. And after action with the group action.
    You can download my app "Countdown Alarm". You need step by step press key "enter, down, enter, down" to cancel it alarm. Because I'm hard to wake. So I design it for someone like me.
  • Ah, got it :) Key sequences may be useful for something like you did, but for my app this only makes the control too complex. If somebody wants to use long presses, he needs to make sure this key is not assigned to a specific function.

    Bye
  • watchfaces can't control any key. widget can only use enter key. Those watch os limit.


    Widget can use any key, just do not pass the event to the main event handler (return true). Ui.BehaviorDelegate descendant class should have similar to the following

    function onKey(evt)
    {
    var key = evt.getKey();

    //... do some useful stuff here.


    if ( key == KEY_ESC )
    {
    doubleBack += 1;
    if (doubleBack > 1) {
    Sys.exit();
    }

    }
    else {
    doubleBack = 0;
    }
    return true; // instead of pass event to the high stack event handler, omit it, mark as handled.
    }


    Counter in this code does not allow to exit immediately, only after 2nd press BACK (or tap -< button twice on edges/oregons).