2013-03-27 27 views

risposta

0

Si sta utilizzando un BroadcastReceiver? Suppongo che tu sia.

da Android Dev:

public void onReceive(Context context, Intent intent) { 
    if (Intent.ACTION_MEDIA_BUTTON.equals(intent.getAction())) { 
     //receive the key press event 
     KeyEvent event = (KeyEvent)intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT); 
     //check the keypress 
     if (KeyEvent.**** == event.getKeyCode()) { 
      // Handle key press. 
     } 
    } 
    } 
} 

** a link with various keypress codes