Android Question Physical ButtonOS Wear

Humberto

Active Member
Licensed User
Hi

I tryed this routine and works in debug mode. with thw TICWatch

https://www.b4x.com/android/forum/threads/physical-buttons-in-android-5.99599/


B4X:
Sub keyrelease(kv As Int)             'ignore
    Log("rels -> " & kv)
End Sub

Sub keypush(kv As Int)                 'ignore
    Log("push -> " & kv)
End Sub

#If JAVA
import android.view.*;

public boolean _onkeydown (int keyCode, android.view.KeyEvent event){
    //BA.Log("Down = " + keyCode);

    if (processBA.subExists("keypush")) {
        processBA.raiseEvent(null,"keypush",keyCode);
        return true;
    }   
    return true;
}

public boolean _onkeyup (int keyCode, android.view.KeyEvent event){
    //BA.Log("Up = " + keyCode);
    if (processBA.subExists("keyrelease")) {
        processBA.raiseEvent(null,"keyrelease",keyCode);
        return true;
    }   
    return true;
}
#End IF
#End Region
When I compile in release mode doesn´t get the button pressed.

I trying with ticwatch with OS Wear

Thanks
 
Top