com.samsung.multiscreen

## Class Application

- java.lang.Object
- - com.samsung.multiscreen.Channel
  - - com.samsung.multiscreen.Application

-     public class Application
      extends Channel

  The `Application` class allows management of installed and web applications on MultiScreen-enabled devices. It provides the facilities to connect, launch and commmunicate with the remote applications.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.samsung.multiscreen.Channel

      `Channel.OnClientConnectListener, Channel.OnClientDisconnectListener, Channel.OnConnectListener, Channel.OnDisconnectListener, Channel.OnErrorListener, Channel.OnMessageListener, Channel.OnReadyListener`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `PROPERTY_VALUE_LIBRARY`
    `static String` | `ROUTE_APPLICATION`
    `static String` | `ROUTE_WEBAPPLICATION`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `connect(Map<String,String> attributes, Result<Client> result)` Connect to the specified channel.
    `void` | `disconnect()` Disconnect from the specified channel.
    `void` | `disconnect(boolean stopOnDisconnect, Result<Client> result)` Disconnect from the specified channel.
    `void` | `disconnect(Result<Client> result)` Disconnect from the specified channel.
    `void` | `getInfo(Result<ApplicationInfo> result)` Retrieve information for the specified application.
    `void` | `install(Result<Boolean> result)` Install the specified application.
    `boolean` | `isConnected()` Returns if the channel is connected and the host is ready to listen for messages.
    `boolean` | `isWebapp()` Returns whether the specified application is a web application.
    `void` | `setOnConnectListener(Channel.OnConnectListener onConnectListener)` Set the listener for connect events.
    `void` | `start(Result<Boolean> result)` Start or launch the specified application.
    `void` | `stop(Result<Boolean> result)` Stop the specified application.
    `String` | `toString()`

    - ### Methods inherited from class com.samsung.multiscreen.Channel

      `addOnMessageListener, connect, connect, connect, getClients, getId, getUri, isDebug, isSecurityMode, publish, publish, publish, publish, publish, publish, publish, publish, removeAllListeners, removeOnMessageListener, removeOnMessageListeners, removeOnMessageListeners, setConnectionTimeout, setDebug, setOnClientConnectListener, setOnClientDisconnectListener, setOnDisconnectListener, setOnErrorListener, setOnReadyListener, setSecurityMode`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### ROUTE_APPLICATION

          public static final String ROUTE_APPLICATION

      See Also:
        Constant Field Values

    - #### ROUTE_WEBAPPLICATION

          public static final String ROUTE_WEBAPPLICATION

      See Also:
        Constant Field Values

    - #### PROPERTY_VALUE_LIBRARY

          public static final String PROPERTY_VALUE_LIBRARY

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### isConnected

          public boolean isConnected()

      Returns if the channel is connected and the host is ready to listen for messages.
      Overrides:
        `isConnected` in class `Channel`
      Returns:
        true, if connected and the host is ready. false, otherwise.

    - #### getInfo

          public void getInfo(Result<ApplicationInfo> result)

      Retrieve information for the specified application.
      Parameters:
        `result` - the asynchronous callback to invoke with the retrieved `ApplicationInfo`

    - #### start

          public void start(Result<Boolean> result)

      Start or launch the specified application.
      Parameters:
        `result` - the asynchronous callback to invoke with the result of starting the application

    - #### stop

          public void stop(Result<Boolean> result)

      Stop the specified application.
      Parameters:
        `result` - the asynchronous callback to invoke with the result of stopping the application

    - #### install

          public void install(Result<Boolean> result)

      Install the specified application. Note that this will fail if the specified application does not exist or a web application is specified.
      Parameters:
        `result` - the asynchronous callback to invoke with the result of installing the application

    - #### connect

          public void connect(Map<String,String> attributes,
                              Result<Client> result)

      Connect to the specified channel.
      Overrides:
        `connect` in class `Channel`
      Parameters:
        `attributes` - option attributes to include in the connect request
        `result` - the callback to invoke with the result of the connect request

    - #### disconnect

          public void disconnect()

      Description copied from class: `Channel`
      Disconnect from the specified channel.
      Overrides:
        `disconnect` in class `Channel`

    - #### disconnect

          public void disconnect(Result<Client> result)

      Description copied from class: `Channel`
      Disconnect from the specified channel.
      Overrides:
        `disconnect` in class `Channel`
      Parameters:
        `result` - the callback to invoke with the result of the disconnect request

    - #### disconnect

          public void disconnect(boolean stopOnDisconnect,
                                 Result<Client> result)

      Disconnect from the specified channel.
      Parameters:
        `stopOnDisconnect` - stop the TV application, if true. Otherwise, disconnect and leave the TV application running.
        `result` - the callback to invoke with the result of the disconnect request

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Channel`

    - #### setOnConnectListener

          public void setOnConnectListener(Channel.OnConnectListener onConnectListener)

      Description copied from class: `Channel`
      Set the listener for connect events. Setting the parameter to `null` will remove the listener.
      Overrides:
        `setOnConnectListener` in class `Channel`

    - #### isWebapp

          public boolean isWebapp()

      Returns whether the specified application is a web application.
      Returns:
        true, if the application is a web application. false, otherwise.