다음을 통해 공유


MediaSessionManager.GetActiveSessions(ComponentName) Method

Definition

Get a list of controllers for all ongoing sessions.

[Android.Runtime.Register("getActiveSessions", "(Landroid/content/ComponentName;)Ljava/util/List;", "")]
public System.Collections.Generic.IList<Android.Media.Session.MediaController> GetActiveSessions (Android.Content.ComponentName? notificationListener);
[<Android.Runtime.Register("getActiveSessions", "(Landroid/content/ComponentName;)Ljava/util/List;", "")>]
member this.GetActiveSessions : Android.Content.ComponentName -> System.Collections.Generic.IList<Android.Media.Session.MediaController>

Parameters

notificationListener
ComponentName

The enabled notification listener component. May be null.

Returns

A list of controllers for ongoing sessions.

Attributes

Remarks

Get a list of controllers for all ongoing sessions. The controllers will be provided in priority order with the most important controller at index 0.

This requires the android.Manifest.permission#MEDIA_CONTENT_CONTROL permission be held by the calling app. You may also retrieve this list if your app is an enabled notification listener using the NotificationListenerService APIs, in which case you must pass the ComponentName of your enabled listener.

Java documentation for android.media.session.MediaSessionManager.getActiveSessions(android.content.ComponentName).

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