Can Android Wearable apps detect the power button as a KeyEvent or by other means? I would like to run a listener service to detect the wearable power button.
I tried this but no log corresponding to a KeyEvent occurred.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    Log.e(">>>>>>", "FindPhoneActivity event "+event);
    if (keyCode == KeyEvent.KEYCODE_POWER) {
        // Do something here...
        Log.e(">>>>>>", "FindPhoneActivity onKeyDown");
        //event.startTracking(); // Needed to track long presses
        return true;
    }
    return super.onKeyDown(keyCode, event);
}
I have also experimented with two solutions used on normal android phone apps
- Registering a Broadcast Receiever
- Creating an onPause event with PowerManagement
Both methods described here. Android - how to receive broadcast intents ACTION_SCREEN_ON/OFF?
I tested the above with logs attached to the event but neither produced logs.
 
    