CastRemoteDisplayClient

public class CastRemoteDisplayClient extends GoogleApi<Api.ApiOptions.NoOptions>

The low level API for starting a Cast Remote Display session (see CastRemoteDisplay). In most use cases CastRemoteDisplayLocalService should be considered instead as it will simplify managing the Cast Remote Display session when the main activity goes to background and will provide a customizable default notification. CastRemoteDisplayClient is available for the use cases where the Cast Remote Display rendering has to happen in a foreground service that runs in a separate process.

Inherited Field Summary

Public Method Summary

Task<Display>
startRemoteDisplay(CastDevice castDevice, String applicationId, int configPreset, PendingIntent sessionEndedPendingIntent)
The low level API for starting a Cast Remote Display session.
Task<Void>
stopRemoteDisplay()
The low level API for stopping a Cast Remote Display session.

Inherited Method Summary

Public Methods

public Task<Display> startRemoteDisplay (CastDevice castDevice, String applicationId, int configPreset, PendingIntent sessionEndedPendingIntent)

The low level API for starting a Cast Remote Display session. Calling this method will terminate any Cast Remote Display session previously started on this Android device.

Parameters
castDevice The CastDevice to start Cast Remote Display. Must not be null.
applicationId The ID of Cast Remote Display application (from the Cast developer portal). Must not be null.
configPreset The desired streaming preset, which is one of CastRemoteDisplay.Configuration
sessionEndedPendingIntent An optional PendingIntent. If provided, it will be fired when the Cast Remote Display session started by this call is ended. Caller can register a BroadcastReceiver to receive it. In the received Intent, an int extra keyed by EXTRA_INT_SESSION_ENDED_STATUS_CODE contains the CastStatusCodes indicating the reason that caused the remote display session to end.
Returns
  • A Task that will be successful if the remote display session could be started normally, in this case it will contain the display that can be used with a Presentation.

public Task<Void> stopRemoteDisplay ()

The low level API for stopping a Cast Remote Display session.

Returns
  • A Task that will be successful if the remote display session could be stopped normally. Must not be null.