MediaSession.SetMediaButtonBroadcastReceiver(ComponentName) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Set the component name of the manifest-declared android.content.BroadcastReceiver
class that should receive media buttons.
[Android.Runtime.Register("setMediaButtonBroadcastReceiver", "(Landroid/content/ComponentName;)V", "", ApiSince=31)]
public void SetMediaButtonBroadcastReceiver (Android.Content.ComponentName? broadcastReceiver);
[<Android.Runtime.Register("setMediaButtonBroadcastReceiver", "(Landroid/content/ComponentName;)V", "", ApiSince=31)>]
member this.SetMediaButtonBroadcastReceiver : Android.Content.ComponentName -> unit
Parameters
- broadcastReceiver
- ComponentName
the component name of the BroadcastReceiver class
- Attributes
Remarks
Set the component name of the manifest-declared android.content.BroadcastReceiver
class that should receive media buttons. This allows 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 to the broadcast receiver. On apps targeting Android U and above, this will throw an IllegalArgumentException
if the provided ComponentName
does not resolve to an existing android.content.BroadcastReceiver broadcast receiver
.
Note: The given android.content.BroadcastReceiver
should belong to the same package as the context that was given when creating MediaSession
.
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.