Android.Media.AudioManager.DispatchMediaKeyEvent Method
Sends a simulated key event for a media button.

Syntax

[Android.Runtime.Register("dispatchMediaKeyEvent", "(Landroid/view/KeyEvent;)V", "GetDispatchMediaKeyEvent_Landroid_view_KeyEvent_Handler")]
public virtual void DispatchMediaKeyEvent (Android.Views.KeyEvent keyEvent)

Parameters

keyEvent
a Android.Views.KeyEvent instance whose key code is one of Android.Views.KeyEvent.KEYCODE_MUTE, Android.Views.KeyEvent.KEYCODE_HEADSETHOOK, Android.Views.KeyEvent.KEYCODE_MEDIA_PLAY, Android.Views.KeyEvent.KEYCODE_MEDIA_PAUSE, Android.Views.KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE, Android.Views.KeyEvent.KEYCODE_MEDIA_STOP, Android.Views.KeyEvent.KEYCODE_MEDIA_NEXT, Android.Views.KeyEvent.KEYCODE_MEDIA_PREVIOUS, Android.Views.KeyEvent.KEYCODE_MEDIA_REWIND, Android.Views.KeyEvent.KEYCODE_MEDIA_RECORD, Android.Views.KeyEvent.KEYCODE_MEDIA_FAST_FORWARD, Android.Views.KeyEvent.KEYCODE_MEDIA_CLOSE, Android.Views.KeyEvent.KEYCODE_MEDIA_EJECT, or Android.Views.KeyEvent.KEYCODE_MEDIA_AUDIO_TRACK.

Remarks

Sends a simulated key event for a media button. To simulate a key press, you must first send a KeyEvent built with a Android.Views.KeyEvent.ACTION_DOWN action, then another event with the Android.Views.KeyEvent.ACTION_UP action.

The key event will be sent to the current media key event consumer which registered with AudioManager.RegisterMediaButtonEventReceiver(Android.App.PendingIntent).

[Android Documentation]

Requirements

Namespace: Android.Media
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1