Summary: Protected Ctors | Methods | Inherited Methods | [Expand All]
public abstract class

# SessionProvider

extends Object

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

## Class Overview

An abstract base class for performing session construction. The SDK uses a subclass of `SessionProvider` to construct `CastSession` internally. If your app wants to support other types of `Session` then you should subclass this class. Subclasses must implement `createSession(String)` and `isSessionRecoverable()`, which will be called by the Cast SDK during the lifecycle of the session. All methods must be called from the main thread.

## Summary

Protected Constructors
| SessionProvider(Context applicationContext, String category) Constructs a `SessionProvider` with a category string.

Public Methods
abstract Session | createSession(String sessionId) Constructs a new `Session`.
final String | getCategory() Returns the category string for this `SessionProvider`.
final Context | getContext() Returns the application `Context` used to construct this instance.
abstract boolean | isSessionRecoverable() Returns `true` if a previously constructed session can be resumed.

[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()

## Protected Constructors

#### protected SessionProvider (Context applicationContext, String category)

Constructs a `SessionProvider` with a category string. The category uniquely identifies a `Session` created by this provider.

##### Parameters

applicationContext | The application Context of the calling app.
category | The category string used to create `Session`.

## Public Methods

#### public abstract Session createSession (String sessionId)

Constructs a new `Session`. This method is called by the SDK to create a new session.

#### public final String getCategory ()

Returns the category string for this `SessionProvider`.

#### public final Context getContext ()

Returns the application `Context` used to construct this instance.

#### public abstract boolean isSessionRecoverable ()

Returns `true` if a previously constructed session can be resumed. Subclasses should check any persisted information about the previous session, such as a session ID, and return true only if it is possible to resume that session. This method is called by the SDK when it tries to resume a previously saved session.