I'm developing a wearOs application, Where I have a feature, app will do something when user long press on physical back-key even my app is background. Currently I'm stuck there. I get the event when my app is foreground but I also want this event when the app is in background.
I used this code to get the event:
override fun onKeyLongPress(keyCode: Int, event: KeyEvent?): Boolean {
if ( keyCode == KeyEvent.KEYCODE_BACK)
{
// Do something
}
return super.onKeyLongPress(keyCode, event)
}
Now my question is there any way to get this or any work-around there ??