1

In my android application I want to detect an headphone long press, but it seems long click of headphone button is by-default delievred to Google now application.

Below is my code :

    KeyEvent event = mediaButtonEvent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);

       if (KeyEvent.KEYCODE_HEADSETHOOK == event.getKeyCode() && 
                   event.getAction() == KeyEvent.FLAG_LONG_PRESS) {

        }

Is long press delivery to other apps been disabled by Android platform, can only Google now application is allowed to get the long press event ?

Prashant
  • 4,474
  • 8
  • 34
  • 82

0 Answers0