MediaSession Constructors
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.
Overloads
MediaSession(Context, String) |
Creates a new session. |
MediaSession(Context, String, Bundle) |
Creates a new session. |
MediaSession(Context, String)
Creates a new session.
[Android.Runtime.Register(".ctor", "(Landroid/content/Context;Ljava/lang/String;)V", "")]
public MediaSession (Android.Content.Context context, string tag);
[<Android.Runtime.Register(".ctor", "(Landroid/content/Context;Ljava/lang/String;)V", "")>]
new Android.Media.Session.MediaSession : Android.Content.Context * string -> Android.Media.Session.MediaSession
Parameters
- context
- Context
The context to use to create the session.
- tag
- String
A short name for debugging purposes.
- Attributes
Remarks
Creates a new session. The session will automatically be registered with the system but will not be published until #setActive(boolean) setActive(true)
is called. You must call #release()
when finished with the session.
Note that RuntimeException
will be thrown if an app creates too many sessions.
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
MediaSession(Context, String, Bundle)
Creates a new session.
[Android.Runtime.Register(".ctor", "(Landroid/content/Context;Ljava/lang/String;Landroid/os/Bundle;)V", "", ApiSince=29)]
public MediaSession (Android.Content.Context context, string tag, Android.OS.Bundle? sessionInfo);
[<Android.Runtime.Register(".ctor", "(Landroid/content/Context;Ljava/lang/String;Landroid/os/Bundle;)V", "", ApiSince=29)>]
new Android.Media.Session.MediaSession : Android.Content.Context * string * Android.OS.Bundle -> Android.Media.Session.MediaSession
Parameters
- context
- Context
The context to use to create the session.
- tag
- String
A short name for debugging purposes.
- sessionInfo
- Bundle
A bundle for additional information about this session.
Controllers can get this information by calling
MediaController#getSessionInfo()
.
An IllegalArgumentException
will be thrown if this contains
any non-framework Parcelable objects.
- Attributes
Remarks
Creates a new session. The session will automatically be registered with the system but will not be published until #setActive(boolean) setActive(true)
is called. You must call #release()
when finished with the session.
The sessionInfo
can include additional unchanging information about this session. For example, it can include the version of the application, or the list of the custom commands that this session supports.
Note that RuntimeException
will be thrown if an app creates too many sessions.
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.