# MediaSessionService.Listener

Artifact: [androidx.media3:media3-session](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/session/MediaSessionService.java+class:androidx.media3.session.MediaSessionService.Listener)

*** ** * ** ***


```
@UnstableApi
public interface MediaSessionService.Listener
```

<br />

*** ** * ** ***

Listener for `https://developer.android.com/reference/androidx/media3/session/MediaSessionService`.

The methods will be called on the main thread.

## Summary

| ### Public methods |
|---|---|
| `default void` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 31) https://developer.android.com/reference/androidx/media3/session/MediaSessionService.Listener#onForegroundServiceStartNotAllowedException()()` Called when the service fails to start in the foreground and a `https://developer.android.com/reference/android/app/ForegroundServiceStartNotAllowedException.html` is thrown on Android 12 or later. |

## Public methods

### onForegroundServiceStartNotAllowedException

```
@RequiresApi(value = 31)
default void onForegroundServiceStartNotAllowedException()
```

Called when the service fails to start in the foreground and a `https://developer.android.com/reference/android/app/ForegroundServiceStartNotAllowedException.html` is thrown on Android 12 or later.