Added in API level 28

MbmsStreamingSession


open class MbmsStreamingSession : AutoCloseable
kotlin.Any
   ↳ android.telephony.MbmsStreamingSession

This class provides functionality for streaming media over MBMS.

Summary

Public methods
open Unit

Terminates this instance.

open static MbmsStreamingSession?
create(context: Context, executor: Executor, subscriptionId: Int, callback: MbmsStreamingSessionCallback)

Create a new MbmsStreamingSession using the given subscription ID.

open static MbmsStreamingSession!
create(context: Context, executor: Executor, callback: MbmsStreamingSessionCallback)

Create a new MbmsStreamingSession using the system default data subscription ID.

open Unit

An inspection API to retrieve the list of streaming media currently be advertised.

open StreamingService?
startStreaming(serviceInfo: StreamingServiceInfo!, executor: Executor, callback: StreamingServiceCallback!)

Starts streaming a requested service, reporting status to the indicated callback.

Public methods

close

Added in API level 28
open fun close(): Unit

Terminates this instance. Also terminates any streaming services spawned from this instance as if StreamingService#close() had been called on them. After this method returns, no further callbacks originating from the middleware will be enqueued on the provided instance of MbmsStreamingSessionCallback, but callbacks that have already been enqueued will still be delivered. It is safe to call create(android.content.Context,java.util.concurrent.Executor,int,android.telephony.mbms.MbmsStreamingSessionCallback) to obtain another instance of MbmsStreamingSession immediately after this method returns. May throw an IllegalStateException

Exceptions
java.lang.Exception if this resource cannot be closed

create

Added in API level 28
open static fun create(
    context: Context,
    executor: Executor,
    subscriptionId: Int,
    callback: MbmsStreamingSessionCallback
): MbmsStreamingSession?

Create a new MbmsStreamingSession using the given subscription ID. Note that this call will bind a remote service. You may not call this method on your app's main thread. You may only have one instance of MbmsStreamingSession per UID. If you call this method while there is an active instance of MbmsStreamingSession in your process (in other words, one that has not had close() called on it), this method will throw an IllegalStateException. If you call this method in a different process running under the same UID, an error will be indicated via MbmsStreamingSessionCallback#onError(int, String). Note that initialization may fail asynchronously. If you wish to try again after you receive such an asynchronous error, you must call close() on the instance of MbmsStreamingSession that you received before calling this method again.

Parameters
context Context: The Context to use. This value cannot be null.
executor Executor: The executor on which you wish to execute callbacks. This value cannot be null.
subscriptionId Int: The subscription ID to use.
callback MbmsStreamingSessionCallback: A callback object on which you wish to receive results of asynchronous operations. This value cannot be null.
Return
MbmsStreamingSession? An instance of MbmsStreamingSession, or null if an error occurred.

create

Added in API level 28
open static fun create(
    context: Context,
    executor: Executor,
    callback: MbmsStreamingSessionCallback
): MbmsStreamingSession!

Create a new MbmsStreamingSession using the system default data subscription ID. See create(android.content.Context,java.util.concurrent.Executor,int,android.telephony.mbms.MbmsStreamingSessionCallback).

Parameters
context Context: This value cannot be null.
executor Executor: This value cannot be null.
callback MbmsStreamingSessionCallback: This value cannot be null.

requestUpdateStreamingServices

Added in API level 28
open fun requestUpdateStreamingServices(serviceClassList: MutableList<String!>!): Unit

An inspection API to retrieve the list of streaming media currently be advertised. The results are returned asynchronously via MbmsStreamingSessionCallback#onStreamingServicesUpdated(List) on the callback provided upon creation. Multiple calls replace the list of service classes of interest. May throw an IllegalArgumentException or an IllegalStateException.

Parameters
serviceClassList MutableList<String!>!: A list of streaming service classes that the app would like updates on. The exact names of these classes should be negotiated with the wireless carrier separately.

startStreaming

Added in API level 28
open fun startStreaming(
    serviceInfo: StreamingServiceInfo!,
    executor: Executor,
    callback: StreamingServiceCallback!
): StreamingService?

Starts streaming a requested service, reporting status to the indicated callback. Returns an object used to control that stream. The stream may not be ready for consumption immediately upon return from this method -- wait until the streaming state has been reported via android.telephony.mbms.StreamingServiceCallback#onStreamStateUpdated(int, int) May throw an IllegalArgumentException or an IllegalStateException Asynchronous errors through the callback include any of the errors in MbmsErrors.GeneralErrors or MbmsErrors.StreamingErrors.

Parameters
serviceInfo StreamingServiceInfo!: The information about the service to stream.
executor Executor: The executor on which you wish to execute callbacks for this stream. This value cannot be null.
callback StreamingServiceCallback!: A callback that'll be called when something about the stream changes.
Return
StreamingService? An instance of StreamingService through which the stream can be controlled. May be null if an error occurred.