MediaRoute2ProviderService.OnCreateSession Method

Definition

Called when the service receives a request to create a session.

[Android.Runtime.Register("onCreateSession", "(JLjava/lang/String;Ljava/lang/String;Landroid/os/Bundle;)V", "GetOnCreateSession_JLjava_lang_String_Ljava_lang_String_Landroid_os_Bundle_Handler", ApiSince=30)]
public abstract void OnCreateSession (long requestId, string packageName, string routeId, Android.OS.Bundle? sessionHints);
[<Android.Runtime.Register("onCreateSession", "(JLjava/lang/String;Ljava/lang/String;Landroid/os/Bundle;)V", "GetOnCreateSession_JLjava_lang_String_Ljava_lang_String_Landroid_os_Bundle_Handler", ApiSince=30)>]
abstract member OnCreateSession : int64 * string * string * Android.OS.Bundle -> unit

Parameters

requestId
Int64

the ID of this request

packageName
String

the package name of the application that selected the route

routeId
String

the ID of the route initially being connected

sessionHints
Bundle

an optional bundle of app-specific arguments sent by MediaRouter2, or null if none. The contents of this bundle may affect the result of session creation.

Attributes

Remarks

Called when the service receives a request to create a session.

You should create and maintain your own session and notifies the client of session info. Call #notifySessionCreated(long, RoutingSessionInfo) with the given requestId to notify the information of a new session. The created session must have the same route feature and must include the given route specified by routeId.

If the session can be controlled, you can optionally pass the control hints to RoutingSessionInfo.Builder#setControlHints(Bundle). Control hints is a Bundle which contains how to control the session.

If you can't create the session or want to reject the request, call #notifyRequestFailed(long, int) with the given requestId.

Java documentation for android.media.MediaRoute2ProviderService.onCreateSession(long, java.lang.String, java.lang.String, android.os.Bundle).

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