Udostępnij za pośrednictwem


MediaSession.Callback.OnMediaButtonEvent(Intent) Method

Definition

Called when a media button is pressed and this session has the highest priority or a controller sends a media button event to the session.

[Android.Runtime.Register("onMediaButtonEvent", "(Landroid/content/Intent;)Z", "GetOnMediaButtonEvent_Landroid_content_Intent_Handler")]
public virtual bool OnMediaButtonEvent (Android.Content.Intent mediaButtonIntent);
[<Android.Runtime.Register("onMediaButtonEvent", "(Landroid/content/Intent;)Z", "GetOnMediaButtonEvent_Landroid_content_Intent_Handler")>]
abstract member OnMediaButtonEvent : Android.Content.Intent -> bool
override this.OnMediaButtonEvent : Android.Content.Intent -> bool

Parameters

mediaButtonIntent
Intent

an intent containing the KeyEvent as an extra

Returns

True if the event was handled, false otherwise.

Attributes

Remarks

Called when a media button is pressed and this session has the highest priority or a controller sends a media button event to the session. The default behavior will call the relevant method if the action for it was set.

The intent will be of type Intent#ACTION_MEDIA_BUTTON with a KeyEvent in Intent#EXTRA_KEY_EVENT

Java documentation for android.media.session.MediaSession.Callback.onMediaButtonEvent(android.content.Intent).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to