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)
<T extends Session> void removeSessionManagerListener(SessionManagerListener<T> listener, Class sessionClass)
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public void addSessionManagerListener (SessionManagerListener<Session> listener)

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

Parameters
listener SessionManagerListener
Throws
NullPointerException If listener is null.
IllegalStateException If this method is not called on the main thread.

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

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

Parameters
listener SessionManagerListener
sessionClass Class
Throws
NullPointerException If listener or sessionClass are null.
IllegalStateException If this method is not called on the main thread.

public void endCurrentSession (boolean stopCasting)

Ends the current session.

Parameters
stopCasting boolean: Should the receiver application be stopped when ending the current Session.
Throws
IllegalStateException If this method is not called on the main thread.

public CastSession getCurrentCastSession ()

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

Returns
CastSession
Throws
IllegalStateException If this method is not called on the main thread.

public Session getCurrentSession ()

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

Returns
Session
Throws
IllegalStateException If this method is not called on the main thread.

public void removeSessionManagerListener (SessionManagerListener<Session> listener)

Removes the SessionManagerListener.

Parameters
listener SessionManagerListener: The SessionManagerListener to be removed.
Throws
IllegalStateException If this method is not called on the main thread.

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

Removes the SessionManagerListener.

Parameters
listener SessionManagerListener: The SessionManagerListener to be removed.
sessionClass Class
Throws
NullPointerException If sessionClass is null.
IllegalStateException If this method is not called on the main thread.