Summary: Methods | Inherited Methods | [Expand All]
public class

# SessionManager

extends Object

java.lang.Object
↳ | com.google.android.gms.cast.framework.SessionManager

## Class Overview

A class that manages `Session` instances. The application can attach a `SessionManagerListener` to be notified of session events.

## Summary

Public Methods
void | addSessionManagerListener(SessionManagerListener<Session> listener) Adds a `SessionManagerListener` to monitor events from any type of `Session` instance.
<T extends Session> void | addSessionManagerListener(SessionManagerListener<T> listener, Class<T> sessionClass) Adds a `SessionManagerListener` to monitor events from a `Session` instance whose class is `sessionClass`.
void | endCurrentSession(boolean stopCasting) Ends the current session.
CastSession | getCurrentCastSession() Returns the current session if it is an instance of `CastSession`, otherwise returns `null`.
Session | getCurrentSession() Returns the currently active session.
void | removeSessionManagerListener(SessionManagerListener<Session> listener) Removes the `SessionManagerListener`.
<T extends Session> void | removeSessionManagerListener(SessionManagerListener<T> listener, Class sessionClass) Removes the `SessionManagerListener`.

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
final void | wait()

## Public Methods

#### public void addSessionManagerListener (SessionManagerListener<Session> listener)

Adds a `SessionManagerListener` to monitor events from any type of `Session` instance.

##### Throws

NullPointerException | If listener is `null`.

#### public void addSessionManagerListener (SessionManagerListener<T> listener, Class<T> sessionClass)

Adds a `SessionManagerListener` to monitor events from a `Session` instance whose class is `sessionClass`.

##### Throws

NullPointerException | If `listener` or `sessionClass` are `null`.

#### public void endCurrentSession (boolean stopCasting)

Ends the current session.

##### Parameters

stopCasting | Should the receiver application be stopped when ending the current Session.

#### public CastSession getCurrentCastSession ()

Returns the current session if it is an instance of `CastSession`, otherwise returns `null`.

#### public Session getCurrentSession ()

Returns the currently active session. Returns `null` if no session is active.

#### public void removeSessionManagerListener (SessionManagerListener<Session> listener)

Removes the `SessionManagerListener`.

##### Parameters

listener | The `SessionManagerListener` to be removed.

#### public void removeSessionManagerListener (SessionManagerListener<T> listener, Class sessionClass)

Removes the `SessionManagerListener`.

##### Parameters

listener | The `SessionManagerListener` to be removed.

##### Throws

NullPointerException | If `sessionClass` is `null`.