Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/android/telephony/MbmsStreamingSession#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/telephony/MbmsStreamingSession#inhmethods)

# MbmsStreamingSession

*** ** * ** ***

` public class MbmsStreamingSession `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/java/lang/AutoCloseable `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.telephony.MbmsStreamingSession |

<br />

*** ** * ** ***

This class provides functionality for streaming media over MBMS.

## Summary

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/telephony/MbmsStreamingSession#close()() ` Terminates this instance. |
| ` static https://developer.android.com/reference/android/telephony/MbmsStreamingSession` | ` https://developer.android.com/reference/android/telephony/MbmsStreamingSession#create(android.content.Context,%20java.util.concurrent.Executor,%20int,%20android.telephony.mbms.MbmsStreamingSessionCallback)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/java/util/concurrent/Executor executor, int subscriptionId, https://developer.android.com/reference/android/telephony/mbms/MbmsStreamingSessionCallback callback) ` Create a new `https://developer.android.com/reference/android/telephony/MbmsStreamingSession` using the given subscription ID. |
| ` static https://developer.android.com/reference/android/telephony/MbmsStreamingSession` | ` https://developer.android.com/reference/android/telephony/MbmsStreamingSession#create(android.content.Context,%20java.util.concurrent.Executor,%20android.telephony.mbms.MbmsStreamingSessionCallback)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/telephony/mbms/MbmsStreamingSessionCallback callback) ` Create a new `https://developer.android.com/reference/android/telephony/MbmsStreamingSession` using the system default data subscription ID. |
| ` void` | ` https://developer.android.com/reference/android/telephony/MbmsStreamingSession#requestUpdateStreamingServices(java.util.List<java.lang.String>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String> serviceClassList) ` An inspection API to retrieve the list of streaming media currently be advertised. |
| ` https://developer.android.com/reference/android/telephony/mbms/StreamingService` | ` https://developer.android.com/reference/android/telephony/MbmsStreamingSession#startStreaming(android.telephony.mbms.StreamingServiceInfo,%20java.util.concurrent.Executor,%20android.telephony.mbms.StreamingServiceCallback)(https://developer.android.com/reference/android/telephony/mbms/StreamingServiceInfo serviceInfo, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/telephony/mbms/StreamingServiceCallback callback) ` Starts streaming a requested service, reporting status to the indicated callback. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
From interface ` https://developer.android.com/reference/java/lang/AutoCloseable ` ` abstract void` ` https://developer.android.com/reference/java/lang/AutoCloseable#close()() `

Closes this resource, relinquishing any underlying resources.

## Public methods

### close

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void close ()
```

Terminates this instance. Also terminates any streaming services spawned from this instance as if `https://developer.android.com/reference/android/telephony/mbms/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 `https://developer.android.com/reference/android/telephony/mbms/MbmsStreamingSessionCallback`, but callbacks that have already been enqueued will still be delivered. It is safe to call `https://developer.android.com/reference/android/telephony/MbmsStreamingSession#create(android.content.Context,%20java.util.concurrent.Executor,%20int,%20android.telephony.mbms.MbmsStreamingSessionCallback)` to obtain another instance of `https://developer.android.com/reference/android/telephony/MbmsStreamingSession` immediately after this method returns. May throw an `https://developer.android.com/reference/java/lang/IllegalStateException`

<br />

### create

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static MbmsStreamingSession create (Context context, 
                Executor executor, 
                int subscriptionId, 
                MbmsStreamingSessionCallback callback)
```

Create a new `https://developer.android.com/reference/android/telephony/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 `https://developer.android.com/reference/android/telephony/MbmsStreamingSession` per UID. If you call this method while there is an active instance of `https://developer.android.com/reference/android/telephony/MbmsStreamingSession` in your process (in other words, one that has not had `https://developer.android.com/reference/android/telephony/MbmsStreamingSession#close()` called on it), this method will throw an `https://developer.android.com/reference/java/lang/IllegalStateException`. If you call this method in a different process running under the same UID, an error will be indicated via `https://developer.android.com/reference/android/telephony/mbms/MbmsStreamingSessionCallback#onError(int,%20java.lang.String)`. Note that initialization may fail asynchronously. If you wish to try again after you receive such an asynchronous error, you must call `https://developer.android.com/reference/android/telephony/MbmsStreamingSession#close()` on the instance of `https://developer.android.com/reference/android/telephony/MbmsStreamingSession` that you received before calling this method again.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: The `https://developer.android.com/reference/android/content/Context` to use. This value cannot be `null`. <br /> |
| `executor` | `Executor`: The executor on which you wish to execute callbacks. This value cannot be `null`. <br /> |
| `subscriptionId` | `int`: The subscription ID to use. <br /> |
| `callback` | `MbmsStreamingSessionCallback`: A callback object on which you wish to receive results of asynchronous operations. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/telephony/MbmsStreamingSession` | An instance of `https://developer.android.com/reference/android/telephony/MbmsStreamingSession`, or null if an error occurred. <br /> |

### create

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static MbmsStreamingSession create (Context context, 
                Executor executor, 
                MbmsStreamingSessionCallback callback)
```

Create a new `https://developer.android.com/reference/android/telephony/MbmsStreamingSession` using the system default data subscription ID. See `https://developer.android.com/reference/android/telephony/MbmsStreamingSession#create(android.content.Context,%20java.util.concurrent.Executor,%20int,%20android.telephony.mbms.MbmsStreamingSessionCallback)`.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: This value cannot be `null`. <br /> |
| `executor` | `Executor`: This value cannot be `null`. <br /> |
| `callback` | `MbmsStreamingSessionCallback`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/telephony/MbmsStreamingSession` | <br /> |

### requestUpdateStreamingServices

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestUpdateStreamingServices (List<String> serviceClassList)
```

An inspection API to retrieve the list of streaming media currently be advertised. The results are returned asynchronously via `https://developer.android.com/reference/android/telephony/mbms/MbmsStreamingSessionCallback#onStreamingServicesUpdated(java.util.List<android.telephony.mbms.StreamingServiceInfo>)` on the callback provided upon creation. Multiple calls replace the list of service classes of interest. May throw an `https://developer.android.com/reference/java/lang/IllegalArgumentException` or an `https://developer.android.com/reference/java/lang/IllegalStateException`.

<br />

| Parameters ||
|---|---|
| `serviceClassList` | `List`: 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. <br /> |

### startStreaming

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public StreamingService startStreaming (StreamingServiceInfo serviceInfo, 
                Executor executor, 
                StreamingServiceCallback callback)
```

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 `https://developer.android.com/reference/android/telephony/mbms/StreamingServiceCallback#onStreamStateUpdated(int,%20int)` May throw an `https://developer.android.com/reference/java/lang/IllegalArgumentException` or an `https://developer.android.com/reference/java/lang/IllegalStateException` Asynchronous errors through the callback include any of the errors in `https://developer.android.com/reference/android/telephony/mbms/MbmsErrors.GeneralErrors` or `https://developer.android.com/reference/android/telephony/mbms/MbmsErrors.StreamingErrors`.

<br />

| Parameters ||
|---|---|
| `serviceInfo` | `StreamingServiceInfo`: The information about the service to stream. <br /> |
| `executor` | `Executor`: The executor on which you wish to execute callbacks for this stream. This value cannot be `null`. <br /> |
| `callback` | `StreamingServiceCallback`: A callback that'll be called when something about the stream changes. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/telephony/mbms/StreamingService` | An instance of `https://developer.android.com/reference/android/telephony/mbms/StreamingService` through which the stream can be controlled. May be `null` if an error occurred. <br /> |