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 Product API.

Since : 2.3

Product : TV, B2B

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. Interfaces

1.1 AppCommonManagerObject

Defines a WebApi object instance of the Tizen Samsung 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();

Product : TV, B2B

Return Value :

  • DOMString : DOMString Plugin version

Since : 2.3

Code Example :

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

setScreenSaver

This method sets the state of the screensaver between on and off.

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

Product : TV, B2B

Parameters :

  • state : Screensaver state
  • onsuccess [optional][nullable] : Callback method to invoke when the screensaver is set successfully
  • onerror [optional][nullable] : 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.

Since : 2.3

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();

Product : TV

Return Value :

  • DOMString : Randomized 36-character UUID

Since : 2.4

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;
  };

};