Wednesday, 18 September 2013

android-how to detect key presses from a Service?

android-how to detect key presses from a Service?

it is possible to detect when the back key is pressed via overriding
onKeyDown in an Activity:
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU) {
//do your work
return true;
}
return super.onKeyDown(keyCode, event);
}
now, how to detect that from a Service?

No comments:

Post a Comment