top

AppCommon API

To use Samsung Product API, 

<script type="text/javascript" src="$WEBAPIS/webapis/webapis.js"></script>

Should be loaded in index.html

This module defines the application information retrieval functionalities provided by the Tizen Samsung TV Product API.

Since: 2.3

Product: TV, B2B

Table of Contents

  1. 1. Interfaces
    1. 1.1. AppCommonManagerObject
    2. 1.2. AppCommonManager
    3. 1.3. AppCommonScreenSaverState
  2. 2. Full WebIDL

Summary of Interfaces and Methods

Interface Method
AppCommonManagerObject  
AppCommonManager

DOMString getVersion ()
void setScreenSaver (AppCommonScreenSaverState state, optional SuccessCallback ? onsuccess, optional ErrorCallback ? onerror)
DOMString  getUuid ()

AppCommonScreenSaverState  

1.1. AppCommonManagerObject

Defines a WebApi object instance of the Tizen Samsung TV Product API.
The webapis.appcommon object enables access to AppCommon API functionality.

[NoInterfaceObject]interface AppCommonManagerObject {
  readonly attribute AppCommonManager appcommon;
};
	

  WebApi implements AppCommonManagerObject;

Attributes

1.2. AppCommonManager

Provides methods for AppCommon functionalities.

[NoInterfaceObject]interface AppCommonManager {
  attribute AppCommonScreenSaverState AppCommonScreenSaverState;
  DOMString getVersion();
  void setScreenSaver(AppCommonScreenSaverState state, optional SuccessCallback ? onsuccess, optional ErrorCallback ? onerror);
  DOMString getUuid();
};
	

Attributes

Methods

getVersion
Retrieves the plugin version number.

DOMString getVersion();

Since: 2.3

Product: TV, B2B

Return value:

DOMString Plugin version

Code example:


try {
  var value = webapis.appcommon.getVersion();
  console.log("version value = " + value);
} catch (error) {
  console.log("error code = " + error.code);
}
setScreenSaver
Sets the screensaver.

void setScreenSaver(AppCommonScreenSaverState state, optional SuccessCallback ? onsuccess, optional ErrorCallback ? onerror);

Since: 2.3

Product: TV, B2B

Parameters:

  • state: Screensaver state
  • onsuccess [optional]: Callback method to invoke when the screensaver is set successfully
  • onerror [optional]: Callback method to invoke if an error occurs

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if an input parameter is not compatible with its expected type.

    • with error type InvalidValuesError, if any input parameter contains an invalid value. (Since plugin version 3.0)

Code example:


function onsuccess(data)  {
  console.log("setScreensavervalue = " + data);
}
function onerror(error)  {
  console.log("error code : " + error.code);
}
try {
  webapis.appcommon.setScreenSaver(webapis.appcommon.AppCommonScreenSaverState.SCREEN_SAVER_OFF, onsuccess, onerror);
} catch (error) {
  console.log("error code = " + error.code);
}
getUuid
Retrieves the Universally Unique Identifier (UUID). Each application generates a different UUID for the same device.
The UUID must not be used for advertising purposes, and must be used complying with all applicable privacy and data protection laws and regulations, including user consent.
If the application also uses the Tizen Identifier for Advertising (TIFA), the UUID must be transferred on the network using a separate stream from the TIFA.
The UUID and TIFA must be handled separately from each other within your server during all data processing, storage, use, and deletion.

DOMString getUuid();

Since: 2.4

Product: TV

Return value:

DOMString Randomized 36-character UUID

Code example:


try {
  var value = webapis.appcommon.getUuid();
  console.log("Uuid value = " + value);
} catch (e) {
  if (e.message.indexOf('undefined') == -1) {
    // Error, such as a missing privilege
  } else {
    // Undefined error
    // Older firmware and models do not support this method
    // Consider using a legacy method
  }
}                

1.3. AppCommonScreenSaverState

Defines constants for screensaver states.

[NoInterfaceObject]interface AppCommonScreenSaverState {
  const unsigned long SCREEN_SAVER_OFF = 0;
  const unsigned long SCREEN_SAVER_ON = 1;
};
	

Constants

  • SCREEN_SAVER_OFF
    Screensaver off
  • SCREEN_SAVER_ON
    Screensaver on

2. Full WebIDL


module AppCommon {
  [NoInterfaceObject]interface AppCommonManagerObject {
    readonly attribute AppCommonManager appcommon;
  };

  WebApi implements AppCommonManagerObject;

  [NoInterfaceObject]interface AppCommonManager {
    attribute AppCommonScreenSaverState AppCommonScreenSaverState;

    DOMString getVersion();
      void setScreenSaver(AppCommonScreenSaverState state, optional SuccessCallback ? onsuccess, optional ErrorCallback ? onerror);
    DOMString getUuid();
  };

  [NoInterfaceObject]interface AppCommonScreenSaverState {
    const unsigned long SCREEN_SAVER_OFF = 0;
    const unsigned long SCREEN_SAVER_ON = 1;
  };
};