Sony SmartWatch2: klucz do zawieszania

W rozszerzeniu kontrolnym dla Sony SmartWatch2 mogę otrzymać klucz powrotny za pomocą onKey, ale jak mogę zapobiec przerwaniu rozszerzenia? Chcę cofnąć klucz, aby wykonać jakiś proces, ale naciśnięcie klawisza Wstecz kończy rozszerzenie.

W SampleAdvancedControlExtension wygląda na to, że blokuje przycisk Wstecz, uruchamiając nową kontrolkę, ale używam tylko pojedynczego sterowania.

public void onKey(int action, int keyCode, long timeStamp) {
    Log.v(SampleExtensionService.LOG_TAG, "onKey");

    if (action == Control.Intents.KEY_ACTION_RELEASE
            && keyCode == Control.KeyCodes.KEYCODE_BACK) {
        Log.d(SampleExtensionService.LOG_TAG, "onKey() - back button intercepted.");
        onBack();
    } else if (mCurrentControl != null) {
        super.onKey(action, keyCode, timeStamp);
    }
}

/**
 * Closes the currently open control extension. If there is a control on the
 * back stack it is opened, otherwise extension is closed.
 */
public void onBack() {
    Log.v(SampleExtensionService.LOG_TAG, "onBack");
    if (!mControlStack.isEmpty()) {
        Intent backControl = mControlStack.pop();
        ControlExtension newControl = createControl(backControl);
        startControl(newControl);
    } else {
        stopRequest();
    }
}

Ok, zrozumiałem problem. Musiałem dodać następującą metodę w klasie RegistrationInformation.

@Override
public boolean controlInterceptsBackButton() {
    // Extension has it's own navigation, handles back presses.
    return true;
}

questionAnswers(1)

yourAnswerToTheQuestion