Skip to content Skip to sidebar Skip to footer

MEDIA_BUTTON Button Event ACTION_DOWN And ACTION_UP Received At The Same Time

In my app I want to measure how long the media button press was. I registered a broadcastReceiver that listens to the media button press: (please excuse stupid mistakes as I am a b

Solution 1:

You don't need to use your own timers. You can use the getDownTime and getEventTime methods of the event parameter when receiving the KeyEvent.ACTION_UP action.

Also, The nested <action android:name="android.intent.action.MEDIA_BUTTON"/> in your manifest is not required


Post a Comment for "MEDIA_BUTTON Button Event ACTION_DOWN And ACTION_UP Received At The Same Time"