Share via


MediaSession.SetMediaButtonReceiver(PendingIntent) Method

Definition

Set a pending intent for your media button receiver to allow restarting playback after the session has been stopped.

[Android.Runtime.Register("setMediaButtonReceiver", "(Landroid/app/PendingIntent;)V", "")]
public void SetMediaButtonReceiver (Android.App.PendingIntent? mbr);
[<Android.Runtime.Register("setMediaButtonReceiver", "(Landroid/app/PendingIntent;)V", "")>]
member this.SetMediaButtonReceiver : Android.App.PendingIntent -> unit

Parameters

mbr
PendingIntent

The PendingIntent to send the media button event to.

Attributes

Remarks

Set a pending intent for your media button receiver to allow restarting playback after the session has been stopped. If your app is started in this way an Intent#ACTION_MEDIA_BUTTON intent will be sent via the pending intent.

The pending intent is recommended to be explicit to follow the security recommendation of PendingIntent#getActivity.

This member is deprecated. Use #setMediaButtonBroadcastReceiver(ComponentName) instead.

Java documentation for android.media.session.MediaSession.setMediaButtonReceiver(android.app.PendingIntent).

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