I am new to Android development and I am trying to create an application.
I want to know if key events can be received even when the phone is locked?
For example, for a music player to change music when I press a button DPAD_CENTER_BUTTON
Doing something like this:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_ENTER:
{
return true;
}
}
return super.onKeyDown(keyCode, event);
}
Is it possible?
source
share