WebOSTVService¶
com.connectsdk.service.WebOSTVService
extends DeviceService
WebOSTVService provides capabilities for LG Smart TVs running webOS (model year 2014). The second screen gateway running on the webOS provides different capabilities based on whether pairing is enabled or not.
- Web app launching & two-way communication
- App launching
- Media playback
- Media control
- Volume control
- Text input control*
- Key control (fiveway)*
- Mouse control*
- Power control*
- TV control (change channels, get channel info)*
- External input control*
- Toast control*
* = requires pairing
Commands & subscriptions on webOS occur over a WebSocket connection.
webOS Version History¶
The following version numbers represent the version of webOS released for LG Smart TVs. The version numbers are associated with any changes to the platform’s second screen APIs in that particular version.
- 4.0.0
- Initial release
- 4.0.1
- No changes
- 4.0.2
- Added app-to-app support
- Added the ability to request pin or prompt pairing
- 4.0.3
- Fixed a subscription bug in app-to-app
Properties¶
final String ID = “webOS TV”
final String[] kWebOSTVServiceOpenPermissions = { “LAUNCH”, “LAUNCH_WEBAPP”, “APP_TO_APP”, “CONTROL_AUDIO”, “CONTROL_INPUT_MEDIA_PLAYBACK” }
final String[] kWebOSTVServiceProtectedPermissions = { “CONTROL_POWER”, “READ_INSTALLED_APPS”, “CONTROL_DISPLAY”, “CONTROL_INPUT_JOYSTICK”, “CONTROL_INPUT_MEDIA_RECORDING”, “CONTROL_INPUT_TV”, “READ_INPUT_DEVICE_LIST”, “READ_NETWORK_STATE”, “READ_TV_CHANNEL_LIST”, “WRITE_NOTIFICATION_TOAST” }
final String[] kWebOSTVServicePersonalActivityPermissions = { “CONTROL_INPUT_TEXT”, “CONTROL_MOUSE_AND_KEYBOARD”, “READ_CURRENT_CHANNEL”, “READ_RUNNING_APPS” }
Inner Classes¶
- ACRAuthTokenListener
- LaunchPointsListener
- SecureAccessTestListener
- ServiceInfoListener
- SystemInfoListener
- WebOSTVServicePermission
Methods¶
WebOSTVService (ServiceDescription serviceDescription, ServiceConfig serviceConfig)
- Parameters:
- serviceDescription
- serviceConfig
void setPairingType (PairingType pairingType)
- Parameters:
- pairingType
CapabilityPriorityLevel getPriorityLevel (Class<?extends CapabilityMethods > clazz)
- Parameters:
- clazz
void setServiceDescription (ServiceDescription serviceDescription)
- Parameters:
- serviceDescription
boolean isConnected ()
void connect ()
void disconnect ()
void cancelPairing ()
Launcher getLauncher ()
CapabilityPriorityLevel getLauncherCapabilityLevel ()
void launchApp (String appId, AppLaunchListener listener)
- Parameters:
- appId
- listener – (optional) AppLaunchListener with methods to be called on success or failure
void launchAppWithInfo (AppInfo appInfo, Launcher.AppLaunchListener listener)
- Parameters:
- appInfo
- listener – (optional) Launcher.AppLaunchListener with methods to be called on success or failure
void launchAppWithInfo (final AppInfo appInfo, Object params, final Launcher.AppLaunchListener listener)
- Parameters:
- appInfo
- params
- listener – (optional) final Launcher.AppLaunchListener with methods to be called on success or failure
void launchBrowser (String url, final Launcher.AppLaunchListener listener)
- Parameters:
- url
- listener – (optional) final Launcher.AppLaunchListener with methods to be called on success or failure
void launchYouTube (String contentId, Launcher.AppLaunchListener listener)
- Parameters:
- contentId
- listener – (optional) Launcher.AppLaunchListener with methods to be called on success or failure
void launchYouTube (final String contentId, float startTime, final AppLaunchListener listener)
- Parameters:
- contentId
- startTime
- listener – (optional) final AppLaunchListener with methods to be called on success or failure
void launchHulu (String contentId, Launcher.AppLaunchListener listener)
- Parameters:
- contentId
- listener – (optional) Launcher.AppLaunchListener with methods to be called on success or failure
void launchNetflix (String contentId, Launcher.AppLaunchListener listener)
- Parameters:
- contentId
- listener – (optional) Launcher.AppLaunchListener with methods to be called on success or failure
void launchAppStore (String appId, AppLaunchListener listener)
- Parameters:
- appId
- listener – (optional) AppLaunchListener with methods to be called on success or failure
void closeApp (LaunchSession launchSession, ResponseListener <Object> listener)
- Parameters:
- launchSession
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void getAppList (final AppListListener listener)
- Parameters:
- listener – (optional) final AppListListener with methods to be called on success or failure
void getRunningApp (AppInfoListener listener)
- Parameters:
- listener – (optional) AppInfoListener with methods to be called on success or failure
ServiceSubscription <AppInfoListener> subscribeRunningApp (AppInfoListener listener)
- Parameters:
- listener – (optional) AppInfoListener with methods to be called on success or failure
void getAppState (LaunchSession launchSession, AppStateListener listener)
- Parameters:
- launchSession
- listener – (optional) AppStateListener with methods to be called on success or failure
ServiceSubscription <AppStateListener> subscribeAppState (LaunchSession launchSession, AppStateListener listener)
- Parameters:
- launchSession
- listener – (optional) AppStateListener with methods to be called on success or failure
ToastControl getToastControl ()
CapabilityPriorityLevel getToastControlCapabilityLevel ()
void showToast (String message, ResponseListener <Object> listener)
- Parameters:
- message
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void showToast (String message, String iconData, String iconExtension, ResponseListener <Object> listener)
- Parameters:
- message
- iconData
- iconExtension
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void showClickableToastForApp (String message, AppInfo appInfo, JSONObject params, ResponseListener <Object> listener)
- Parameters:
- message
- appInfo
- params
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void showClickableToastForApp (String message, AppInfo appInfo, JSONObject params, String iconData, String iconExtension, ResponseListener <Object> listener)
- Parameters:
- message
- appInfo
- params
- iconData
- iconExtension
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void showClickableToastForURL (String message, String url, ResponseListener <and-responselistener> <Object> listener)
- Parameters:
- message
- url
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void showClickableToastForURL (String message, String url, String iconData, String iconExtension, ResponseListener <and-responselistener> <Object> listener)
- Parameters:
- message
- url
- iconData
- iconExtension
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
VolumeControl getVolumeControl ()
CapabilityPriorityLevel getVolumeControlCapabilityLevel ()
void volumeUp ()
void volumeUp (ResponseListener <Object> listener)
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void volumeDown ()
void volumeDown (ResponseListener <Object> listener)
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void setVolume (int volume)
- Parameters:
- volume
void setVolume (float volume, ResponseListener <Object> listener)
- Parameters:
- volume
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void getVolume (VolumeListener listener)
- Parameters:
- listener – (optional) VolumeListener with methods to be called on success or failure
ServiceSubscription <VolumeListener> subscribeVolume (VolumeListener listener)
- Parameters:
- listener – (optional) VolumeListener with methods to be called on success or failure
void setMute (boolean isMute, ResponseListener <Object> listener)
- Parameters:
- isMute
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void getMute (MuteListener listener)
- Parameters:
- listener – (optional) MuteListener with methods to be called on success or failure
ServiceSubscription <MuteListener> subscribeMute (MuteListener listener)
- Parameters:
- listener – (optional) MuteListener with methods to be called on success or failure
void getVolumeStatus (VolumeStatusListener listener)
- Parameters:
- listener – (optional) VolumeStatusListener with methods to be called on success or failure
ServiceSubscription <VolumeStatusListener> subscribeVolumeStatus (VolumeStatusListener listener)
- Parameters:
- listener – (optional) VolumeStatusListener with methods to be called on success or failure
MediaPlayer getMediaPlayer ()
CapabilityPriorityLevel getMediaPlayerCapabilityLevel ()
void getMediaInfo (MediaInfoListener listener)
- Parameters:
- listener – (optional) MediaInfoListener with methods to be called on success or failure
ServiceSubscription <MediaInfoListener> subscribeMediaInfo (MediaInfoListener listener)
- Parameters:
- listener – (optional) MediaInfoListener with methods to be called on success or failure
void displayImage (final String url, final String mimeType, final String title, final String description, final String iconSrc, final MediaPlayer.LaunchListener listener)
- Parameters:
- url
- mimeType
- title
- description
- iconSrc
- listener – (optional) final MediaPlayer.LaunchListener with methods to be called on success or failure
void displayImage (MediaInfo mediaInfo, MediaPlayer.LaunchListener listener)
- Parameters:
- mediaInfo
- listener – (optional) MediaPlayer.LaunchListener with methods to be called on success or failure
void playMedia (String url, String mimeType, String title, String description, String iconSrc, boolean shouldLoop, MediaPlayer.LaunchListener listener)
- Parameters:
- url
- mimeType
- title
- description
- iconSrc
- shouldLoop
- listener – (optional) MediaPlayer.LaunchListener with methods to be called on success or failure
void playMedia (MediaInfo mediaInfo, boolean shouldLoop, MediaPlayer.LaunchListener listener)
- Parameters:
- mediaInfo
- shouldLoop
- listener – (optional) MediaPlayer.LaunchListener with methods to be called on success or failure
void closeMedia (LaunchSession launchSession, ResponseListener <Object> listener)
- Parameters:
- launchSession
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
MediaControl getMediaControl ()
Get MediaControl implementation
Returns: MediaControl
CapabilityPriorityLevel getMediaControlCapabilityLevel ()
Get a capability priority for current implementation
Returns: CapabilityPriorityLevel
void play (ResponseListener <Object> listener)
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void pause (ResponseListener <Object> listener)
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void stop (ResponseListener <Object> listener)
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void rewind (ResponseListener <Object> listener)
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void fastForward (ResponseListener <Object> listener)
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called onsuccess or failure
void previous (ResponseListener <Object> listener)
This method is deprecated. Use
PlaylistControl::previous(ResponseListener<Object> listener)
instead.
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void next (ResponseListener <Object> listener)
This method is deprecated. Use
PlaylistControl::next(ResponseListener<Object> listener)
instead.
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void seek (long position, ResponseListener <Object> listener)
- Parameters:
- position – The new position, in milliseconds from the beginning of the stream
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void getDuration (DurationListener listener)
Get the current media duration in milliseconds
- Parameters:
- listener – (optional) DurationListener with methods to be called on success or failure
void getPosition (PositionListener listener)
Get the current playback position in milliseconds
- Parameters:
- listener – (optional) PositionListener with methods to be called on success or failure
TVControl getTVControl ()
CapabilityPriorityLevel getTVControlCapabilityLevel ()
void channelUp ()
void channelUp (ResponseListener <Object> listener)
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void channelDown ()
void channelDown (ResponseListener <Object> listener)
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void setChannel (ChannelInfo channelInfo, ResponseListener <Object> listener)
Sets current channel
- Parameters:
- channelInfo – must not be null
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void setChannelById (String channelId)
- Parameters:
- channelId
void setChannelById (String channelId, ResponseListener <and-responselistener> <Object> listener)
- Parameters:
- channelId
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void getCurrentChannel (ChannelListener listener)
- Parameters:
- listener – (optional) ChannelListener with methods to be called on success or failure
ServiceSubscription <ChannelListener> subscribeCurrentChannel (ChannelListener listener)
- Parameters:
- listener – (optional) ChannelListener with methods to be called on success or failure
void getChannelList (ChannelListListener listener)
- Parameters:
- listener – (optional) ChannelListListener with methods to be called on success or failure
ServiceSubscription <ChannelListListener> subscribeChannelList (final ChannelListListener listener)
- Parameters:
- listener – (optional) final ChannelListListener with methods to be called on success or failure
void getChannelCurrentProgramInfo (ProgramInfoListener listener)
- Parameters:
- listener – (optional) ProgramInfoListener with methods to be called on success or failure
ServiceSubscription <ProgramInfoListener> subscribeChannelCurrentProgramInfo (ProgramInfoListener listener)
- Parameters:
- listener – (optional) ProgramInfoListener with methods to be called on success or failure
void getProgramInfo (ProgramInfoListener listener)
- Parameters:
- listener – (optional) ProgramInfoListener with methods to be called on success or failure
ServiceSubscription <ProgramInfoListener> subscribeProgramInfo (ProgramInfoListener listener)
- Parameters:
- listener – (optional) ProgramInfoListener with methods to be called on success or failure
void getProgramList (ProgramListListener listener)
- Parameters:
- listener – (optional) ProgramListListener with methods to be called on success or failure
ServiceSubscription <ProgramListListener> subscribeProgramList (ProgramListListener listener)
- Parameters:
- listener – (optional) ProgramListListener with methods to be called on success or failure
void set3DEnabled (final boolean enabled, final ResponseListener <Object> listener)
- Parameters:
- enabled
- listener – (optional) final ResponseListener< Object > with methods to be called on success or failure
void get3DEnabled (final State3DModeListener listener)
- Parameters:
- listener – (optional) final State3DModeListener with methods to be called on success or failure
ServiceSubscription <State3DModeListener> subscribe3DEnabled (final State3DModeListener listener)
- Parameters:
- listener – (optional) final State3DModeListener with methods to be called on success or failure
ExternalInputControl getExternalInput ()
CapabilityPriorityLevel getExternalInputControlPriorityLevel ()
void launchInputPicker (final AppLaunchListener listener)
- Parameters:
- listener – (optional) final AppLaunchListener with methods to be called on success or failure
void closeInputPicker (LaunchSession launchSession, ResponseListener <Object> listener)
- Parameters:
- launchSession
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void getExternalInputList (final ExternalInputListListener listener)
- Parameters:
- listener – (optional) final ExternalInputListListener with methods to be called on success or failure
void setExternalInput (ExternalInputInfo externalInputInfo, final ResponseListener <Object> listener)
- Parameters:
- externalInputInfo
- listener – (optional) final ResponseListener< Object > with methods to be called on success or failure
MouseControl getMouseControl ()
CapabilityPriorityLevel getMouseControlCapabilityLevel ()
void connectMouse ()
void disconnectMouse ()
void click ()
void move (final double dx, final double dy)
- Parameters:
- dx
- dy
void move (PointF diff)
- Parameters:
- diff
void scroll (final double dx, final double dy)
- Parameters:
- dx
- dy
void scroll (PointF diff)
- Parameters:
- diff
TextInputControl getTextInputControl ()
CapabilityPriorityLevel getTextInputControlCapabilityLevel ()
ServiceSubscription <TextInputStatusListener> subscribeTextInputStatus (TextInputStatusListener listener)
- Parameters:
- listener – (optional) TextInputStatusListener with methods to be called on success or failure
void sendText (String input)
- Parameters:
- input
void sendKeyCode (KeyCode keycode, ResponseListener <Object> listener)
- Parameters:
- keycode
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void sendEnter ()
void sendDelete ()
PowerControl getPowerControl ()
CapabilityPriorityLevel getPowerControlCapabilityLevel ()
void powerOff (ResponseListener <Object> listener)
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void powerOn (ResponseListener <Object> listener)
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
KeyControl getKeyControl ()
CapabilityPriorityLevel getKeyControlCapabilityLevel ()
void up (ResponseListener <Object> listener)
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void down (ResponseListener <Object> listener)
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void left (ResponseListener <Object> listener)
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void right (ResponseListener <Object> listener)
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void ok (final ResponseListener <Object> listener)
- Parameters:
- listener – (optional) final ResponseListener< Object > with methods to be called on success or failure
void back (ResponseListener <Object> listener)
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void home (ResponseListener <Object> listener)
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
WebAppLauncher getWebAppLauncher ()
CapabilityPriorityLevel getWebAppLauncherCapabilityLevel ()
void launchWebApp (final String webAppId, final WebAppSession.LaunchListener listener)
- Parameters:
- webAppId
- listener – (optional) final WebAppSession.LaunchListener with methods to be called on success or failure
void launchWebApp (String webAppId, boolean relaunchIfRunning, WebAppSession.LaunchListener listener)
- Parameters:
- webAppId
- relaunchIfRunning
- listener – (optional) WebAppSession.LaunchListener with methods to be called on success or failure
void launchWebApp (final String webAppId, final JSONObject params, final WebAppSession.LaunchListener listener)
- Parameters:
- webAppId
- params
- listener – (optional) final WebAppSession.LaunchListener with methods to be called on success or failure
void launchWebApp (final String webAppId, final JSONObject params, boolean relaunchIfRunning, final WebAppSession.LaunchListener listener)
- Parameters:
- webAppId
- params
- relaunchIfRunning
- listener – (optional) final WebAppSession.LaunchListener with methods to be called on success or failure
void closeWebApp (LaunchSession launchSession, final ResponseListener <Object> listener)
- Parameters:
- launchSession
- listener – (optional) final ResponseListener< Object > with methods to be called on success or failure
void connectToWebApp (final WebOSWebAppSession webAppSession, final boolean joinOnly, final ResponseListener <Object> connectionListener)
- Parameters:
- webAppSession
- joinOnly
- connectionListener
void pinWebApp (String webAppId, final ResponseListener <Object> listener)
- Parameters:
- webAppId
- listener – (optional) final ResponseListener< Object > with methods to be called on success or failure
void unPinWebApp (String webAppId, final ResponseListener <Object> listener)
- Parameters:
- webAppId
- listener – (optional) final ResponseListener< Object > with methods to be called on success or failure
void isWebAppPinned (String webAppId, WebAppPinStatusListener listener)
- Parameters:
- webAppId
- listener – (optional) WebAppPinStatusListener with methods to be called on success or failure
ServiceSubscription <WebAppPinStatusListener> subscribeIsWebAppPinned (String webAppId, WebAppPinStatusListener listener)
- Parameters:
- webAppId
- listener – (optional) WebAppPinStatusListener with methods to be called on success or failure
void joinApp (String appId, WebAppSession.LaunchListener listener)
- Parameters:
- appId
- listener – (optional) WebAppSession.LaunchListener with methods to be called on success or failure
void connectToApp (String appId, final WebAppSession.LaunchListener listener)
- Parameters:
- appId
- listener – (optional) final WebAppSession.LaunchListener with methods to be called on success or failure
void joinWebApp (final LaunchSession webAppLaunchSession, final WebAppSession.LaunchListener listener)
- Parameters:
- webAppLaunchSession
- listener – (optional) final WebAppSession.LaunchListener with methods to be called on success or failure
void joinWebApp (String webAppId, WebAppSession.LaunchListener listener)
- Parameters:
- webAppId
- listener – (optional) WebAppSession.LaunchListener with methods to be called on success or failure
void sendMessage (String message, LaunchSession launchSession, ResponseListener <Object> listener)
- Parameters:
- message
- launchSession
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void sendMessage (JSONObject message, LaunchSession launchSession, ResponseListener <Object> listener)
- Parameters:
- message
- launchSessio
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void getServiceInfo (final ServiceInfoListener listener)
- Parameters:
- listener – (optional) final ServiceInfoListener with methods to be called on success or failure
void getSystemInfo (final SystemInfoListener listener)
- Parameters:
- listener – (optional) final SystemInfoListener with methods to be called on success or failure
void secureAccessTest (final SecureAccessTestListener listener)
- Parameters:
- listener – (optional) final SecureAccessTestListener with methods to be called on success or failure
void getACRAuthToken (final ACRAuthTokenListener listener)
- Parameters:
- listener – (optional) final ACRAuthTokenListener with methods to be called on success or failure
void getLaunchPoints (final LaunchPointsListener listener)
- Parameters:
- listener – (optional) final LaunchPointsListener with methods to be called on success or failure
PlaylistControl getPlaylistControl ()
CapabilityPriorityLevel getPlaylistControlCapabilityLevel ()
void jumpToTrack (long index, ResponseListener <Object> listener)
Play a track specified by index in the playlist
- Parameters:
- index – index in the playlist, it starts from zero like index of array
- listener – optional response listener
void setPlayMode (PlayMode playMode, ResponseListener <Object> listener)
Set order of playing tracks
- Parameters:
- playMode
- listener – optional response listener
void sendCommand (ServiceCommand<?> command)
- Parameters:
- command
void unsubscribe (URLServiceSubscription<?> subscription)
- Parameters:
- subscription
List<String> getPermissions ()
void setPermissions (List<String> permissions)
- Parameters:
- permissions
void getPlayState (PlayStateListener listener)
Get the current state of playback
- Parameters:
- listener – (optional) PlayStateListener with methods to be called on success or failure
ServiceSubscription <PlayStateListener> subscribePlayState (PlayStateListener listener)
Subscribe for playback state changes
- Parameters:
- listener – receives play state notifications
Returns: ServiceSubscription<PlayStateListener>
boolean isConnectable ()
void sendPairingKey (String pairingKey)
- Parameters:
- pairingKey
static DiscoveryFilter discoveryFilter ()
Inherited Methods¶
- void connect ()
- Will attempt to connect to the DeviceService. The failure/success will be reported back to the DeviceServiceListener. If the connection attempt reveals that pairing is required, the DeviceServiceListener will also be notified in that event.
- void disconnect ()
- Will attempt to disconnect from the DeviceService. The failure/success will be reported back to the DeviceServiceListener.
- boolean isConnected ()
- Whether the DeviceService is currently connected
boolean isConnectable ()
- void cancelPairing ()
- Explicitly cancels pairing in services that require pairing. In some services, this will hide a prompt that is displaying on the device.
- void sendPairingKey (String pairingKey)
Will attempt to pair with the DeviceService with the provided pairingData. The failure/success will be reported back to the DeviceServiceListener.
- Parameters:
- pairingKey – Data to be used for pairing. The type of this parameter will vary depending on what type of pairing is required, but is likely to be a string (pin code, pairing key, etc).
List<String> getCapabilities ()
- boolean hasCapability (String capability)
Test to see if the capabilities array contains a given capability. See the individual Capability classes for acceptable capability values.
It is possible to append a wildcard search term
.Any
to the end of the search term. This method will return true for capabilities that match the term up to the wildcard.Example:
Launcher.App.Any
- Parameters:
- capability – Capability to test against
- boolean hasAnyCapability (String… capabilities)
Test to see if the capabilities array contains at least one capability in a given set of capabilities. See the individual Capability classes for acceptable capability values.
See hasCapability: for a description of the wildcard feature provided by this method.
- Parameters:
- capabilities – Set of capabilities to test against
- boolean hasCapabilities (List<String> capabilities)
Test to see if the capabilities array contains a given set of capabilities. See the individual Capability classes for acceptable capability values.
See hasCapability: for a description of the wildcard feature provided by this method.
- Parameters:
- capabilities – List of capabilities to test against
ServiceDescription getServiceDescription ()
ServiceConfig getServiceConfig ()
JSONObject toJSONObject ()
String getServiceName ()
Name of the DeviceService (webOS, Chromecast, etc)
void closeLaunchSession (LaunchSession launchSession, ResponseListener <Object> listener)
Closes the session on the first screen device. Depending on the sessionType, the associated service will have different ways of handling the close functionality.
- Parameters:
- launchSession – LaunchSession to close
- listener – (optional) listener to be called on success/failure
Launcher getLauncher ()
CapabilityPriorityLevel getLauncherCapabilityLevel ()
void launchAppWithInfo (AppInfo appInfo, AppLaunchListener listener)
Launch an application on the device.
- Related capabilities:
Launcher.App
Launcher.App.Params
– if launching with params- Parameters:
- appInfo – AppInfo object for the application
- listener – (optional) AppLaunchListener with methods to be called on success or failure
void launchApp (String appId, AppLaunchListener listener)
Launch an application on the device.
- Related capabilities:
Launcher.App
- Parameters:
- appId – ID of the application
- listener – (optional) AppLaunchListener with methods to be called on success or failure
void closeApp (LaunchSession launchSession, ResponseListener <Object> listener)
Close an application on the device.
- Related capabilities:
Launcher.App.Close
- Parameters:
- launchSession – LaunchSession of the target app
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void getAppList (AppListListener listener)
Gets a list of all apps installed on the device.
- Related capabilities:
Launcher.App.List
- Parameters:
- listener – (optional) AppListListener with methods to be called on success or failure
void getRunningApp (AppInfoListener listener)
Gets an AppInfo object for the current running app on the device.
- Related capabilities:
Launcher.RunningApp
- Parameters:
- listener – (optional) AppInfoListener with methods to be called on success or failure
ServiceSubscription <AppInfoListener> subscribeRunningApp (AppInfoListener listener)
Subscribes to changes of the current running app. Every time the running app changes, the success block will be called with an AppInfo object for the current running app.
- Related capabilities:
Launcher.RunningApp.Subscribe
- Parameters:
- listener – (optional) AppInfoListener with methods to be called on success or failure
void getAppState (LaunchSession launchSession, AppStateListener listener)
Gets the target app’s running status and on-screen visibility.
- Related capabilities:
Launcher.AppState
- Parameters:
- launchSession – LaunchSession of the target app
- listener – (optional) AppStateListener with methods to be called on success or failure
ServiceSubscription <AppStateListener> subscribeAppState (LaunchSession launchSession, AppStateListener listener)
Subscribes to changes of the state of the target app. Every time the app’s state changes, the success block will be called with info on the app’s running status and on-screen visibility.
- Related capabilities:
Launcher.AppState.Subscribe
- Parameters:
- launchSession – LaunchSession of the target app
- listener – (optional) AppStateListener with methods to be called on success or failure
void launchBrowser (String url, AppLaunchListener listener)
Launch the web browser. Will launch deep-linked to provided URL, if supported on the target platform.
- Related capabilities:
Launcher.Browser
Launcher.Browser.Params
– if launching with url- Parameters:
- url
- listener – (optional) AppLaunchListener with methods to be called on success or failure
void launchYouTube (String contentId, AppLaunchListener listener)
Launch YouTube app. Will launch deep-linked to provided contentId, if supported on the target platform.
- Related capabilities:
Launcher.YouTube
Launcher.YouTube.Params
– if launching with contentId- Parameters:
- contentId – Video id to open
- listener – (optional) AppLaunchListener with methods to be called on success or failure
void launchNetflix (String contentId, AppLaunchListener listener)
Launch Netflix app. Will launch deep-linked to provided contentId, if supported on the target platform.
- Related capabilities:
Launcher.Netflix
Launcher.Netflix.Params
– if launching with contentId- Parameters:
- contentId – Video id to open
- listener – (optional) AppLaunchListener with methods to be called on success or failure
void launchHulu (String contentId, AppLaunchListener listener)
Launch Hulu app. Will launch deep-linked to provided contentId, if supported on the target platform.
- Related capabilities:
Launcher.Hulu
Launcher.Hulu.Params
– if launching with contentId- Parameters:
- contentId – Video id to open
- listener – (optional) AppLaunchListener with methods to be called on success or failure
void launchAppStore (String appId, AppLaunchListener listener)
Launch the device’s app store app, optionally deep-linked to a specific app’s page.
- Related capabilities:
Launcher.AppStore
Launcher.AppStore.Params
- Parameters:
- appId – (optional) ID of the application to show in the app store
- listener – (optional) AppLaunchListener with methods to be called on success or failure
MediaControl getMediaControl ()
Get MediaControl implementation
Returns: MediaControl
CapabilityPriorityLevel getMediaControlCapabilityLevel ()
Get a capability priority for current implementation
Returns: CapabilityPriorityLevel
void play (ResponseListener <Object> listener)
Send play command.
- Related capabilities:
MediaControl.Play
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void pause (ResponseListener <Object> listener)
Send pause command.
- Related capabilities:
MediaControl.Pause
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void stop (ResponseListener <Object> listener)
Send play command.
- Related capabilities:
MediaControl.Stop
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void rewind (ResponseListener <Object> listener)
Send rewind command.
- Related capabilities:
MediaControl.Rewind
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void fastForward (ResponseListener <Object> listener)
Send play command.
- Related capabilities:
MediaControl.FastForward
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void previous (ResponseListener <Object> listener)
This method is deprecated. Use
PlaylistControl::previous(ResponseListener<Object> listener)
instead.
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void next (ResponseListener <Object> listener)
This method is deprecated. Use
PlaylistControl::next(ResponseListener<Object> listener)
instead.
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void seek (long position, ResponseListener <Object> listener)
Seeks to a new position within the current media item
- Related capabilities:
MediaControl.Seek
- Parameters:
- position – The new position, in milliseconds from the beginning of the stream
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void getDuration (DurationListener listener)
Get the current media duration in milliseconds
- Parameters:
- listener – (optional) DurationListener with methods to be called on success or failure
- void getPosition (PositionListener listener)
Get the current playback position in milliseconds
- Parameters:
- listener – (optional) PositionListener with methods to be called on success or failure
- void getPlayState (PlayStateListener listener)
Get the current state of playback
- Parameters:
- listener – (optional) PlayStateListener with methods to be called on success or failure
- ServiceSubscription <PlayStateListener> subscribePlayState (PlayStateListener listener)
Subscribe for playback state changes
- Parameters:
- listener – receives play state notifications
Returns: ServiceSubscription<PlayStateListener>
MediaPlayer getMediaPlayer ()
CapabilityPriorityLevel getMediaPlayerCapabilityLevel ()
void getMediaInfo (MediaInfoListener listener)
- Parameters:
- listener – (optional) MediaInfoListener with methods to be called on success or failure
ServiceSubscription <MediaInfoListener> subscribeMediaInfo (MediaInfoListener listener)
- Parameters:
- listener – (optional) MediaInfoListener with methods to be called on success or failure
void displayImage (MediaInfo mediaInfo, LaunchListener listener)
Display an image on the device. Not all devices support all of the parameters – supply as many as you have available.
- Related capabilities:
MediaPlayer.Display.Image
MediaPlayer.MediaData.Title
MediaPlayer.MediaData.Description
MediaPlayer.MediaData.Thumbnail
MediaPlayer.MediaData.MimeType
- Parameters:
- mediaInfo – Object of MediaInfo class which includes all the information about an image to display.
- listener – (optional) LaunchListener with methods to be called on success or failure
void playMedia (MediaInfo mediaInfo, boolean shouldLoop, LaunchListener listener)
Play an audio or video file on the device. Not all devices support all of the parameters – supply as many as you have available.
- Related capabilities:
MediaPlayer.Play.Video
MediaPlayer.Play.Audio
MediaPlayer.MediaData.Title
MediaPlayer.MediaData.Description
MediaPlayer.MediaData.Thumbnail
MediaPlayer.MediaData.MimeType
Parameters:
- mediaInfo – Object of MediaInfo class which includes all the information about an image to display.
- shouldLoop – Whether to automatically loop playback
- listener – (optional) LaunchListener with methods to be called on success or failure
void closeMedia (LaunchSession launchSession, ResponseListener <Object> listener)
Close a running media session. Because media is handled differently on different platforms, it is required to keep track of LaunchSession and MediaControl objects to control that media session in the future. LaunchSession will be required to close the media and mediaControl will be required to control the media.
- Related capabilities:
MediaPlayer.Close
- Parameters:
- launchSession – LaunchSession object for use in closing media instance
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
VolumeControl getVolumeControl ()
CapabilityPriorityLevel getVolumeControlCapabilityLevel ()
void volumeUp (ResponseListener <Object> listener)
Sends the volume up command to the device.
- Related capabilities:
VolumeControl.UpDown
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void volumeDown (ResponseListener <Object> listener)
Sends the volume down command to the device.
- Related capabilities:
VolumeControl.UpDown
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void setVolume (float volume, ResponseListener <Object> listener)
Set the volume of the device.
- Related capabilities:
VolumeControl.Set
- Parameters:
- volume – Volume as a float between 0.0 and 1.0
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void getVolume (VolumeListener listener)
Get the current volume of the device.
- Related capabilities:
VolumeControl.Get
- Parameters:
- listener – (optional) VolumeListener with methods to be called on success or failure
void setMute (boolean isMute, ResponseListener <Object> listener)
Set the current volume.
- Related capabilities:
VolumeControl.Mute.Set
- Parameters:
- isMute
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void getMute (MuteListener listener)
Get the current mute state.
- Related capabilities:
VolumeControl.Mute.Get
- Parameters:
- listener – (optional) MuteListener with methods to be called on success or failure
ServiceSubscription <VolumeListener> subscribeVolume (VolumeListener listener)
Subscribe to the volume on the TV.
- Related capabilities:
VolumeControl.Subscribe
- Parameters:
- listener – (optional) VolumeListener with methods to be called on success or failure
ServiceSubscription <MuteListener> subscribeMute (MuteListener listener)
Subscribe to the mute state on the TV.
- Related capabilities:
VolumeControl.Mute.Subscribe
- Parameters:
- listener – (optional) MuteListener with methods to be called on success or failure
TVControl getTVControl ()
CapabilityPriorityLevel getTVControlCapabilityLevel ()
void channelUp (ResponseListener <Object> listener)
Sends a channel up command to the TV.
- Related capabilities:
TVControl.Channel.Up
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void channelDown (ResponseListener <Object> listener)
Sends a channel down command to the TV.
- Related capabilities:
TVControl.Channel.Down
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void setChannel (ChannelInfo channelNumber, ResponseListener <Object> listener)
Sets the current channel to the channel provided by the ChannelInfo object provided.
- Related capabilities:
TVControl.Channel.Set
- Parameters:
- channelNumber
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void getCurrentChannel (ChannelListener listener)
Gets the current channel info from the TV.
- Related capabilities:
TVControl.Channel.Get
- Parameters:
- listener – (optional) ChannelListener with methods to be called on success or failure
ServiceSubscription <ChannelListener> subscribeCurrentChannel (ChannelListener listener)
Subscribes to any changes in the current channel. Each time the channel is changed, the new channel’s info will be provided to the success callback.
- Related capabilities:
TVControl.Channel.Subscribe
- Parameters:
- listener – (optional) ChannelListener with methods to be called on success or failure
void getChannelList (ChannelListListener listener)
Get a list of available channels from the TV.
- Related capabilities:
TVControl.Channel.List
- Parameters:
- listener – (optional) ChannelListListener with methods to be called on success or failure
void getProgramInfo (ProgramInfoListener listener)
Gets the current program info from the TV.
- Related capabilities:
TVControl.Program.Get
- Parameters:
- listener – (optional) ProgramInfoListener with methods to be called on success or failure
ServiceSubscription <ProgramInfoListener> subscribeProgramInfo (ProgramInfoListener listener)
Subscribes to any changes in the current program. Each time the channel is changed or a new program starts, the new program’s info will be provided to the success callback.
- Related capabilities:
TVControl.Program.Subscribe
- Parameters:
- listener – (optional) ProgramInfoListener with methods to be called on success or failure
void getProgramList (ProgramListListener listener)
Gets a list of all programs scheduled to play on the current channel.
- Related capabilities:
TVControl.Program.List
- Parameters:
- listener – (optional) ProgramListListener with methods to be called on success or failure
ServiceSubscription <ProgramListListener> subscribeProgramList (ProgramListListener listener)
Subscribes to any changes in the current program. Each time the channel is changed or a new program starts, the new program’s info will be provided to the success callback.
- Related capabilities:
TVControl.Program.List.Subscribe
- Parameters:
- listener – (optional) ProgramListListener with methods to be called on success or failure
void get3DEnabled (State3DModeListener listener)
Gets the current 3D status of the TV.
- Related capabilities:
TVControl.3D.Get
- Parameters:
- listener – (optional) State3DModeListener with methods to be called on success or failure
void set3DEnabled (boolean enabled, ResponseListener <Object> listener)
Sets the current 3D status of the TV.
- Related capabilities:
TVControl.3D.Set
- Parameters:
- enabled – Whether the TV’s 3D mode should be on or off
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
ServiceSubscription <State3DModeListener> subscribe3DEnabled (State3DModeListener listener)
Subscribes to changes in the TV’s 3D status.
- Related capabilities:
TVControl.3D.Subscribe
- Parameters:
- listener – (optional) State3DModeListener with methods to be called on success or failure
ToastControl getToastControl ()
CapabilityPriorityLevel <and-capabilityprioritylevel> getToastControlCapabilityLevel ()
void showToast (String message, ResponseListener <Object> listener)
Show a toast on the TV.
- Parameters:
- message – Message to display
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void showClickableToastForApp (String message, AppInfo appInfo, JSONObject params, ResponseListener <Object> listener)
Show a toast on the TV and perform an action when the toast is clicked on the TV.
- Related capabilities:
ToastControl.Show.Clickable.App
ToastControl.Show.Clickable.App.Params
- Parameters:
- message – Message to display
- appInfo – AppInfo for app to launch on click of toast
- params – Launch params for app
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void showClickableToastForURL (String message, String url, ResponseListener <Object> listener)
Show a toast on the TV and perform an action when the toast is clicked on the TV.
- Related capabilities:
ToastControl.Show.Clickable.URL
- Parameters:
- message – Message to display
- url
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
ExternalInputControl getExternalInput ()
CapabilityPriorityLevel getExternalInputControlPriorityLevel ()
void launchInputPicker (AppLaunchListener listener)
Launches the visual input picker on the device. This may be helpful for situations where the device does not support directly listing/modifying the external inputs.
- Related capabilities:
ExternalInputControl.Picker.Launch
- Parameters:
- listener – (optional) AppLaunchListener with methods to be called on success or failure
void closeInputPicker (LaunchSession launchSessionm, ResponseListener <Object> listener)
Closes the input picker on the device, if it is currently open.
- Related capabilities:
ExternalInputControl.Picker.Close
- Parameters:
- launchSessionm
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void getExternalInputList (ExternalInputListListener listener)
Get a list of input devices (HDMI, AV, etc) connected to the device
- Related capabilities:
ExternalInputControl.List
- Parameters:
- listener – (optional) ExternalInputListListener with methods to be called on success or failure
void setExternalInput (ExternalInputInfo input, ResponseListener <Object> listener)
Switch to the specified external input
- Related capabilities:
ExternalInputControl.Set
- Parameters:
- input
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
MouseControl getMouseControl ()
CapabilityPriorityLevel getMouseControlCapabilityLevel ()
void connectMouse ()
Establish a connection with the DeviceService’s mouse communication medium (WebSocket, HTTP, etc). While this step may not be necessary with certain platforms, it is suggested to call it anyways, for purposes of seamless normalization. Calling connect on a non-connectable protocol will just trigger the success callback immediately.
- Related capabilities:
MouseControl.Connect
void disconnectMouse ()
Disconnects from the mouse communication medium.
- Related capabilities:
MouseControl.Disconnect
void click ()
Perform a click action at the current mouse position.
- Related capabilities:
MouseControl.Click
void move (double dx, double dy)
Move the mouse by the given distance values.
- Related capabilities:
MouseControl.Move
- Parameters:
- dx – Distance to move the mouse on the x-axis relative to its current position
- dy – Distance to move the mouse on the y-axis relative to its current position
void scroll (double dx, double dy)
Scroll by the given distance values.
- Related capabilities:
MouseControl.Scroll
- Parameters:
- dx – Distance to scroll the mouse on the x-axis relative to its current position
- dy – Distance to scroll the mouse on the y-axis relative to its current position
TextInputControl getTextInputControl ()
CapabilityPriorityLevel getTextInputControlCapabilityLevel ()
ServiceSubscription <TextInputStatusListener> subscribeTextInputStatus (TextInputStatusListener listener)
Subscribe to information about the current text field.
- Related capabilities:
TextInputControl.Subscribe
- Parameters:
- listener – (optional) TextInputStatusListener with methods to be called on success or failure
void sendText (String input)
Send text to the current text field.
- Related capabilities:
TextInputControl.Send.Text
- Parameters:
- input
- void sendEnter ()
Send enter key to the current text field.
- Related capabilities:
TextInputControl.Send.Enter
void sendDelete ()
Send delete event to the current text field.
- Related capabilities:
TextInputControl.Send.Delete
PowerControl getPowerControl ()
CapabilityPriorityLevel getPowerControlCapabilityLevel ()
void powerOff (ResponseListener <Object> listener)
Sends a power off signal to the TV. A success message will, internally, trigger a disconnection with the device.
- Related capabilities:
PowerControl.Off
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void powerOn (ResponseListener <Object> listener)
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
KeyControl getKeyControl ()
CapabilityPriorityLevel getKeyControlCapabilityLevel ()
void up (ResponseListener <Object> listener)
Sends the up button key code to the TV.
- Related capabilities:
KeyControl.Up
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void down (ResponseListener <Object> listener)
Sends the down button key code to the TV.
- Related capabilities:
KeyControl.Down
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void left (ResponseListener <Object> listener)
Sends the left button key code to the TV.
- Related capabilities:
KeyControl.Left
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void right (ResponseListener <Object> listener)
Sends the right button key code to the TV.
- Related capabilities:
KeyControl.Right
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void ok (ResponseListener <Object> listener)
Sends the OK button key code to the TV.
- Related capabilities:
KeyControl.OK
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void back (ResponseListener <Object> listener)
Sends the back button key code to the TV.
- Related capabilities:
KeyControl.Back
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void home (ResponseListener <Object> listener)
Sends the home button key code to the TV.
- Related capabilities:
KeyControl.Home
- Parameters:
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void sendKeyCode (KeyCode keycode, ResponseListener <Object> listener)
Sends a key code value to the TV.
- Related capabilities:
KeyControl.Send.KeyCode
- Parameters:
- keycode
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
WebAppLauncher getWebAppLauncher ()
CapabilityPriorityLevel getWebAppLauncherCapabilityLevel ()
void launchWebApp (String webAppId, LaunchListener listener)
Launch a web application on the TV.
- Related capabilities:
WebAppLauncher.Launch
WebAppLauncher.Launch.Params
– if launching with params- Parameters:
- webAppId – ID of web app assigned by platform vendor
- listener – (optional) LaunchListener with methods to be called on success or failure
void joinWebApp (LaunchSession webAppLaunchSession, LaunchListener listener)
Join an active web app without launching/relaunching. If the app is not running/joinable, the failure block will be called immediately.
- Related capabilities:
WebAppLauncher.Send
WebAppLauncher.Receive
- Parameters:
- webAppLaunchSession – LaunchSession for the web app to be joined
- listener – (optional) LaunchListener with methods to be called on success or failure
void closeWebApp (LaunchSession launchSession, ResponseListener <Object> listener)
Closes a web app with the provided LaunchSession.
- Related capabilities:
WebAppLauncher.Close
- Parameters:
- launchSession – LaunchSession associated with the web app to be closed
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void pinWebApp (String webAppId, ResponseListener <Object> listener)
- Parameters:
- webAppId
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void unPinWebApp (String webAppId, ResponseListener <Object> listener)
- Parameters:
- webAppId
- listener – (optional) ResponseListener< Object > with methods to be called on success or failure
void isWebAppPinned (String webAppId, WebAppPinStatusListener listener)
- Parameters:
- webAppId
- listener – (optional) WebAppPinStatusListener with methods to be called on success or failure
ServiceSubscription <WebAppPinStatusListener> subscribeIsWebAppPinned (String webAppId, WebAppPinStatusListener listener)
- Parameters:
- webAppId
- listener – (optional) WebAppPinStatusListener with methods to be called on success or failure
PlaylistControl getPlaylistControl ()
CapabilityPriorityLevel getPlaylistControlCapabilityLevel ()
void jumpToTrack (long index, ResponseListener <Object> listener)
Jump the playlist to the designated track.
Play a track specified by index in the playlist
- Related capabilities:
PlaylistControl.JumpToTrack
- Parameters:
- index – index in the playlist, it starts from zero like index of array
- listener – optional response listener
void setPlayMode (PlayMode playMode, ResponseListener <Object> listener)
Set order of playing tracks
- Parameters:
- playMode
- listener – optional response listener
void onLoseReachability (DeviceServiceReachability reachability)
- Parameters:
- reachability
void unsubscribe (URLServiceSubscription<?> subscription)
- Parameters:
- subscription
void sendCommand (ServiceCommand<?> command)
- Parameters:
- command