AppCommon API
To use Samsung Product API,
<script type="text/javascript" src="$WEBAPIS/webapis/webapis.js"></script>
Should be loaded in index.html
Since: 2.3
Product: TV, B2B (LFD, IWB)
Summary of Interfaces and Methods
Interface | Method |
---|---|
AppCommonManagerObject | |
AppCommonManager |
DOMString getVersion () |
AppCommonScreenSaverState |
1.1. AppCommonManagerObject
The webapis.appcommon object enables access to AppCommon API functionality.
[NoInterfaceObject]interface AppCommonManagerObject {
readonly attribute AppCommonManager appcommon;
};
WebApi implements AppCommonManagerObject;
Attributes
- readonly AppCommonManager appcommon
AppCommon API namespace
1.2. AppCommonManager
[NoInterfaceObject]interface AppCommonManager {
attribute AppCommonScreenSaverState AppCommonScreenSaverState;
DOMString getVersion();
void setScreenSaver(AppCommonScreenSaverState state, optional SuccessCallback ? onsuccess, optional ErrorCallback ? onerror);
DOMString getUuid();
};
Attributes
- AppCommonScreenSaverState
AppCommonScreenSaverState
Screen saver state
Methods
getVersion
-
Retrieves the plugin version number.
DOMString getVersion();
Since: 2.3
Product: TV, B2B (LFD, IWB)
Return value:
DOMString Plugin versionCode 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 (LFD)
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 UUIDCode 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
[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;
};
};