3
Sony SmartWatch2의 제어 확장 프로그램에서 onKey를 통해 키를받을 수 있지만 확장이 종료되지 않게하려면 어떻게해야합니까? 나는 어떤 과정을하기 위해 열쇠를 후크하고 싶지만, 뒤로 열쇠를 누르면 확장이 끝난다.Sony SmartWatch2 : 후킹 키
SampleAdvancedControlExtension에서 새 컨트롤을 시작하여 뒤로 단추를 차단하는 것처럼 보이지만 단일 컨트롤 만 사용하고 있습니다.
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();
}
}
좋아, 문제를 알았어. RegistrationInformation 클래스에 다음 메소드를 추가해야했습니다.
@Override
public boolean controlInterceptsBackButton() {
// Extension has it's own navigation, handles back presses.
return true;
}
동일한 문제가 있었지만 매니페스트를 넣는 것을 잊지 마세요. –
jellyfication