java.lang.Object | ||||
↳ | android.content.Context | |||
↳ | android.content.ContextWrapper | |||
↳ | android.app.Service | |||
↳ | com.google.android.gms.cast.CastRemoteDisplayLocalService |
The recommended API for starting and managing a Cast Remote Display session. It simplifies
the creation of a local foreground service to render a CastPresentation
.
Your MyCastRemoteDisplayLocalService should extend CastRemoteDisplayLocalService
and
should be declared in the manifest as follows:
<service android:name=".MyCastRemoteDisplayLocalService" android:exported="false" />
This class should be inherited to create the CastPresentation
on the onCreatePresentation(Display)
call. This guarantees that the
Presentation
lifecycle is associated with the Service. There will be a
Notification
associated with the service
To create the service call startService(Context, Class extends CastRemoteDisplayLocalService>, String, CastDevice, CastRemoteDisplayLocalService.NotificationSettings, CastRemoteDisplayLocalService.Callbacks)
and to terminate
the service call stopService()
.
Application developers can provide their own Notification
.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CastRemoteDisplayLocalService.Callbacks | Callbacks for the Cast Remote Display session initiated using
CastRemoteDisplayLocalService . |
||||||||||
CastRemoteDisplayLocalService.NotificationSettings | Notification settings. | ||||||||||
CastRemoteDisplayLocalService.Options | Options for a remote display session. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
The singleton instance of the
CastRemoteDisplayLocalService . | |||||||||||
The API that will be called when the Cast Remote Display has been created.
| |||||||||||
The API that will be called when the Cast Remote Display should be dismissed because the
Cast Remote Display session is ending.
| |||||||||||
Starts the
CastRemoteDisplayLocalService instance and initiates the remote display
session. | |||||||||||
Starts the
CastRemoteDisplayLocalService instance and initiates the remote display
session. | |||||||||||
Stops the
CastRemoteDisplayLocalService instance and terminates the remote display
session. | |||||||||||
Modifies the current notification settings.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Enables debug logs.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
The singleton instance of the CastRemoteDisplayLocalService
.
Returns | |
---|---|
CastRemoteDisplayLocalService |
The CastRemoteDisplayLocalService instance.
|
Parameters | |
---|---|
intent |
Intent
|
Returns | |
---|---|
IBinder |
The API that will be called when the Cast Remote Display has been created. The implementation
of the service that extends CastRemoteDisplayLocalService
must implement this API to
create a CastPresentation
instance.
Parameters | |
---|---|
display |
Display :
The Cast Remote Display.
|
The API that will be called when the Cast Remote Display should be dismissed because the
Cast Remote Display session is ending. The implementation of the service that extends
CastRemoteDisplayLocalService
must implement this API to dismiss the
CastPresentation
instance.
Parameters | |
---|---|
intent |
Intent
|
flags |
int
|
startId |
int
|
Returns | |
---|---|
int |
Starts the CastRemoteDisplayLocalService
instance and initiates the remote display
session. If a session is already being started it will be ignored.
Parameters | |
---|---|
activityContext |
Context :
The context of the activity that is starting the service.
The cast presentation will create its own Context based
on this Context and information from the Cast Remote Display.
Must not be null . |
serviceClass |
Class :
The class of the service that should be started. The service should be
declared in the manifest (see CastRemoteDisplayLocalService ).
Must not be null . |
applicationId |
String :
The Remote Display application ID provided in the Cast developer portal.
Must not be null . |
device |
CastDevice :
The device that will host the Cast Remote Display session.
Must not be null . |
notificationSettings |
CastRemoteDisplayLocalService.NotificationSettings :
The notificationSettings. It must at least contain a custom
Notification or a notification PendingIntent . Must not be null . |
callbacks |
CastRemoteDisplayLocalService.Callbacks :
The Cast Remote Display session listener. Must not be null .
|
Starts the CastRemoteDisplayLocalService
instance and initiates the remote display
session. If a session is already being started it will be ignored.
Parameters | |
---|---|
activityContext |
Context :
The context of the activity that is starting the service.
The cast presentation will create its own Context based
on this Context and information from the Cast Remote Display.
Must not be null . |
serviceClass |
Class :
The class of the service that should be started. The service should be
declared in the manifest (see CastRemoteDisplayLocalService ).
Must not be null . |
applicationId |
String :
The Remote Display application ID provided in the Cast developer portal.
Must not be null . |
device |
CastDevice :
The device that will host the Cast Remote Display session.
Must not be null . |
options |
CastRemoteDisplayLocalService.Options :
Options for the session.
Must not be null . |
notificationSettings |
CastRemoteDisplayLocalService.NotificationSettings :
The notificationSettings. It must at least contain a custom
Notification or a notification PendingIntent . Must not be null . |
callbacks |
CastRemoteDisplayLocalService.Callbacks :
The Cast Remote Display session listener. Must not be null .
|
Stops the CastRemoteDisplayLocalService
instance and terminates the remote display
session.
Modifies the current notification settings. Settings should be consistent with the type of
notification model used (default or custom).
For example you can replace the existing custom notification, or you can set a new
PendingIntent
, title or text for the default notification.
Parameters | |
---|---|
notificationSettings |
CastRemoteDisplayLocalService.NotificationSettings :
The new notification settings.
|
Returns | |
---|---|
Display |
The Display object available for the remote display session, otherwise
null (if the Cast Remote Display session has not started).
|
Enables debug logs. This method is meant for development purposes only.