### Install web app package Source: https://webostv.developer.lge.com/develop/tools/cli-dev-guide Installs a specified .ipk package file onto the target device. ```bash ares-install --device myTV ./com.domain.app_0.0.1_all.ipk ``` -------------------------------- ### Example appinfo.json Configuration Source: https://webostv.developer.lge.com/develop/references/appinfo-json A comprehensive example of the appinfo.json file structure including mandatory and optional properties. ```json { "id": "com.mycompany.app.appname", "title": "AppName", "main": "index.html", "icon": "AppName_80x80.png", "largeIcon": "AppName_130x130.png", "type": "web", "vendor": "My Company", "version": "1.0.0", "appDescription": "This's an app tagline", "resolution": "1920x1080", "bgColor": "red", "iconColor": "red", "bgImage": "AppName_Preview.png", "closeOnRotation": false "disableBackHistoryAPI": false, "handlesRelaunch": false, "splashBackground": "AppName_Splash.png", "splashColor": "#111111", "splashFitModeOnPortrait": "width", "requiredMemory": 20, "supportPortraitMode": true, "supportTouchMode": "virtual", "transparent": false, "virtualTouch": { "verticalThreshold": 20, "horizontalThreshold": 50, "positionEventOnPress": true, "shortTouchThreshold": 30 }, "accessibility": { "supportsAudioGuidance": true } "screenSaverProperties": { "preferredType": 3 }, "useGalleryMode": true } ``` -------------------------------- ### DEVICE_INFO JSON Format Example Source: https://webostv.developer.lge.com/develop/tools/webos-tv-cli-dev-guide Example of providing target device information using the JSON format. ```json {"host":"127.0.0.1", "port":"6622"} ``` -------------------------------- ### Activity Manager Return Examples Source: https://webostv.developer.lge.com/develop/references/activity-manager These are example JSON payloads for successful activity creation and error responses from the Activity Manager. ```json // Success return - First return (When activity is created) { "activityId": 83, "returnValue": true } ``` ```json // Success return - When activity starts { "event": "start", "activityId": 83, "returnValue": true } ``` ```json // Error return { "errorCode": 22, "returnValue": false, "errorText": "invalid parameters: caller=' error='required property not found - 'activity'" } ``` -------------------------------- ### Interactive device setup Source: https://webostv.developer.lge.com/develop/tools/cli-dev-guide Launches the interactive mode for managing device configurations. ```bash ares-setup-device name deviceinfo connection profile -------- ------------------------ ---------- -------- tv prisoner@10.123.45.67 ssh tv emulator developer@127.0.0.1:6622 ssh tv ** You can modify the device info in the above list, or add new device. ? Select > add modify remove ``` -------------------------------- ### Launch web app Source: https://webostv.developer.lge.com/develop/tools/cli-dev-guide Starts a web application on the target device. ```bash ares-launch --device myTV com.domain.app ``` -------------------------------- ### Subscription Enabled Return Example Source: https://webostv.developer.lge.com/develop/references/magic-remote Example JSON response indicating a successful subscription to sensor data. ```json { "subscribed": true, "returnValue": true } ``` -------------------------------- ### Verify webOS TV CLI Installation Source: https://webostv.developer.lge.com/develop/tools/webos-tv-cli-installation Execute the version command to confirm the CLI is correctly installed and accessible. ```bash $ ares -V webOS TV CLI Version: 1.12.4-j27 ``` -------------------------------- ### Device Info JSON Example Source: https://webostv.developer.lge.com/develop/tools/cli-dev-guide An example of how to format device information using JSON. This format can be used with the --info flag in ares-setup-device. ```json {'host':'10.123.45.67', 'port':'9922'} ``` -------------------------------- ### Linux Emulator Installation Commands Source: https://webostv.developer.lge.com/develop/tools/emulator-installation Execute these commands in the terminal to install the emulator on Linux. Ensure you replace placeholders with your actual paths and versions. ```bash $ cd /LG_WEBOS_TV_SDK_HOME_PATH/Emulator/vX.0.0 $ chmod 777 ./* $ ./vm_register.sh $ ./create_desktop.sh $ sudo desktop-file-install webOS_TV_Emulator_vX.0.0.desktop ``` -------------------------------- ### Install Emulator Launcher Source: https://webostv.developer.lge.com/develop/tools/webos-studio-dev-guide Use this command to install or upgrade the Emulator Launcher, a command-line tool required for Emulator Manager on older webOS Studio versions. Ensure you use 'python' instead of 'python3' on Windows. ```bash python3 -m pip install --upgrade webos-emulator --force-reinstall ``` -------------------------------- ### Example Device Information Output Source: https://webostv.developer.lge.com/develop/getting-started/developer-mode-app This is an example of the device information displayed upon a successful connection between your TV and PC. The details may vary based on your specific TV model. ```text modelName : WEBOS6.0 sdkVersion : 6.1.0 firmwareVersion : 00.00.00 boardType : K7LP_ATSC_KR otaId : HE_DTV_W21P_AFADATAA ``` -------------------------------- ### Sensor Data Subscription Return Example Source: https://webostv.developer.lge.com/develop/references/magic-remote Example JSON response containing detailed sensor data including device ID, coordinates, gyroscope, acceleration, and quaternion values upon successful subscription. ```json { "deviceId": 0, "coordinate": { "x": 1101, "y": 518 }, "gyroscope": { "z": -1.682723, "x": 0.3041, "y": -0.582472 }, "acceleration": { "z": 12.035406, "x": 9.713932, "y": 5.446675 }, "returnValue": true, "quaternion": { "q0": 0.042376, "q1": 0.088355, "q2": 0.937461, "q3": 0.334014 } } ``` -------------------------------- ### Start Local Web Server Source: https://webostv.developer.lge.com/develop/tools/webos-tv-cli-dev-guide The `ares-server` command starts a web server for testing local files. Execute this command in your app's source directory. The server will run on a specified or default port. ```bash ares-server ./sampleApp ``` ```bash Local server running on http://localhost:7496 ``` ```bash ares-server ./sampleApp --open ``` -------------------------------- ### Install webOS CLI Globally Source: https://webostv.developer.lge.com/develop/tools/cli-installation Use this command to install the webOS CLI globally on your system. Ensure Node.js and npm are installed and meet the recommended versions. ```bash $ npm install -g @webos-tools/cli ``` -------------------------------- ### Sample Full Target Devices List Source: https://webostv.developer.lge.com/develop/tools/cli-dev-guide Example output of the 'ares-setup-device --listfull' command, providing detailed JSON objects for each connected device. ```json [ { "profile": "tv", "name": "tv", "deviceinfo": { "ip": "10.123.45.67", "port": "9922", "user": "prisoner" }, "connection": [ "ssh" ], "details": { "platform": "starfish", "privatekey": "tv_webos", "passphrase": "ares-setup-device --full", "description": "new device" } }, { "profile": "tv", "name": "emulator", "deviceinfo": { "ip": "127.0.0.1", "port": "6622", "user": "developer" }, "connection": [ "ssh" ], "details": { "platform": "starfish", "privatekey": "webos_emul", "description": "LG webOS TV Emulator" } } ] ``` -------------------------------- ### Sample Target Devices List Source: https://webostv.developer.lge.com/develop/tools/cli-dev-guide Example output of the 'ares-setup-device --list' command, showing device names, connection details, and profiles. ```text name deviceinfo connection profile --------- ------------------------ ------------ -------- emulator developer@127.0.0.1:6622 ssh tv tv prisoner@10.123.45.67 ssh tv ``` -------------------------------- ### SuccessResponse Object Example Source: https://webostv.developer.lge.com/develop/references/media-database Example of a successful operation response. ```json { "returnValue": false } ``` -------------------------------- ### Start an Activity Source: https://webostv.developer.lge.com/develop/references/activity-manager Attempts to start or resume a specified Activity. If the 'force' parameter is true, other Activities may be canceled to free resources. This method sends 'start' events to subscribed listeners. ```javascript var request = webOS.service.request('luna://com.palm.activitymanager', { method: 'start', parameters: { activityId: 93, }, onSuccess: function (inResponse) { console.log('The Activity is started'); // To-Do something }, onFailure: function (inError) { console.log('Failed to start the Activity'); console.log('[' + inError.errorCode + ']: ' + inError.errorText); // To-Do something return; }, }); ``` -------------------------------- ### Failure Return Example Source: https://webostv.developer.lge.com/develop/references/ble-gatt This is an example of a failed response after attempting to write to a characteristic. ```json { "returnValue": false, "errorCode": 413, "errorText": "GATT write characteristic failed" } ``` -------------------------------- ### ares-setup-device Usage Syntax Source: https://webostv.developer.lge.com/develop/tools/webos-tv-cli-dev-guide Command-line syntax for managing target devices. ```bash ares-setup-device ares-setup-device [OPTIONS...] --add|-a [TARGET_NAME] [--info|-i [DEVICE_INFO]] ares-setup-device [OPTIONS...] --modify|-m [TARGET_NAME] [--info|-i [DEVICE_INFO]] ares-setup-device [OPTIONS...] --remove|-r [TARGET_NAME] ares-setup-device [OPTIONS...] -f, --default [TARGET_NAME] ares-setup-device --search|-s ares-setup-device [--search|-s] --timeout|-t [TIMEOUT] ares-setup-device --reset|-R ares-setup-device --list|-l ares-setup-device --listfull|-F ares-setup-device --version|-V ares-setup-device --help|-h ``` -------------------------------- ### Launch application and handle parameters Source: https://webostv.developer.lge.com/develop/references/webostvjs-webosdev Demonstrates launching an application with custom parameters and listening for launch events to retrieve them. ```javascript // Calls the launch application 'B' in 'A' webOSDev.launch({ id: 'your.app.B', params: { userId: 'user', page: 'shown page', }, onSuccess: function (res) { // do something }, onFailure: function (res) { // error }, }); // 'B' receives parameters that are passed by the application 'A' document.addEventListener('webOSLaunch', function (data) { console.log(data.detail.userId + ', ' + data.detail.page); }); document.addEventListener('webOSRelaunch', function (data) { console.log(data.detail.userId + ', ' + data.detail.page); }); var params = webOSDev.launchParams(); if (params.userId === 'user') { console.log(params.userId + ' wants to access to ' + params.page); } ``` -------------------------------- ### IndexClause Object Example Source: https://webostv.developer.lge.com/develop/references/media-database Example of an index clause for indexing the 'state' property. ```json { "name" : "state", "props" : [{"name": "state"}], "incDel" : false } ``` -------------------------------- ### List installed applications Source: https://webostv.developer.lge.com/develop/tools/cli-dev-guide Verifies installed applications by listing their IDs on the target device. ```bash ares-install --device myTV --list ``` -------------------------------- ### Run Local Web Server with Browser Open Source: https://webostv.developer.lge.com/develop/tools/cli-dev-guide Starts a local web server and automatically opens the webOS TV SDK bundle browser to the served content. ```bash ares-server ./source --open ``` -------------------------------- ### Watch return example Source: https://webostv.developer.lge.com/develop/references/database Example of the JSON object returned by a successful watch request. ```json { "returnValue": true, "fired": true } ``` -------------------------------- ### Search return example Source: https://webostv.developer.lge.com/develop/references/database Example of the JSON object returned by a successful search request. ```json { "count": 4, "returnValue": true, "results": [ { "_rev": 22, "sample": "sample_updated_value", "test": "test1", "_id": "J8rKQDOvxdF", "_kind": "com.yourdomain.test:1" }, { "_rev": 23, "sample": "sample_updated_value", "test": "test1", "_id": "J8rKTaBClIo", "_kind": "com.yourdomain.test:1" }, { "_rev": 26, "sample": "sample1", "test": "test1", "_id": "J8rTH76hfcB", "_kind": "com.yourdomain.test:1" }, { "_rev": 27, "sample": "sample1", "test": "test1", "_id": "J8rTIa65u++", "_kind": "com.yourdomain.test:1" } ] } ``` -------------------------------- ### Generate and Test Sample App Source: https://webostv.developer.lge.com/develop/tools/webos-tv-cli-dev-guide Commands to generate a sample application and launch it on a device for testing without packaging. ```bash # Generate the sample app for test $ ares-generate ./sampleApp ? app id com.domain.app ? title new app ? version 0.0.1 Generating basic in ./sampleApp Success ``` ```bash # Test the sample app on the target device (name: myTV) without packaging and installation $ ares-launch -H ./sampleApp -d myTV Installing package ./sampleApp/com.domain.app.ipk Ares Hosted App is now running... ``` -------------------------------- ### Subscription Return Example Source: https://webostv.developer.lge.com/develop/references/camera Example of the return object for a subscription call to the isCovered method. ```json // Subscription return { 'returnValue': false, 'covered': false, 'subscribed': true } ``` -------------------------------- ### Example Return: Subscription Update Source: https://webostv.developer.lge.com/develop/references/camera This is a sample response received when a subscription is active and the list of connected devices is updated. ```json { 'uriList': [ { ``` -------------------------------- ### List Configured Target Devices Source: https://webostv.developer.lge.com/develop/getting-started/developer-mode-app After adding your TV, use the `ares-setup-device --list` command to verify that the device has been successfully added to your list of target devices. ```bash ares-setup-device --list ``` -------------------------------- ### Sensor State Example Response Source: https://webostv.developer.lge.com/develop/references/magic-remote Example of a successful response when querying the sensor state. ```json { "isAlive": true, "returnValue": true } ``` -------------------------------- ### Install and manage applications with ares-install Source: https://webostv.developer.lge.com/develop/tools/webos-tv-cli-dev-guide Commands for installing, listing, and removing applications on a target device. ```bash ares-install --device emulator com.example.sampleapp_0.0.1_all.ipk ``` ```bash ares-install --device emulator --list ``` ```bash ares-install --device emulator --list --type web ``` ```bash ares-install --device emulator --remove com.example.sampleapp ``` -------------------------------- ### One-time Call Return Example Source: https://webostv.developer.lge.com/develop/references/camera Example of the return object for a one-time call to the isCovered method. ```json // One-time call return { 'returnValue': true, 'covered': true } ``` -------------------------------- ### Launch App on Simulator with Parameters Source: https://webostv.developer.lge.com/develop/tools/cli-dev-guide Launches an app on a simulator with multiple parameters, formatted as a JSON string. ```bash ares-launch -s 24 -sp /home/webOS_TV_24_Simulator_1.4.0 sampleApp -p "{'data1':'foo', 'data2':'bar'}" ``` -------------------------------- ### Failure Return Example Source: https://webostv.developer.lge.com/develop/references/ble-gatt This is an example of a failure return value, including the error code and text. ```json { "returnValue": false, "errorCode": 414, "errorText": "Invalid value input for GATT characteristic" } ``` -------------------------------- ### Configure New Device Information Source: https://webostv.developer.lge.com/develop/getting-started/developer-mode-app Input the necessary details for your TV, such as device name, IP address, port, SSH user, and a description. This step registers the device for connection. ```bash ** You can modify the device info in the above list, or add new device. ? Select: add ? Enter Device Name: tv2 ? Enter Device IP address: 10.123.45.67 ? Enter Device Port: 9922 ? Enter ssh user: prisoner ? Enter description: new device ? Set default? Yes ? Save ? Yes name deviceinfo connection profile -------- -------------------------- ---- -- tv2 (default) prisoner@10.123.45.67:9922 ssh tv emulator developer@127.0.0.1:6622 ssh tv myTV prisoner@192.168.0.22:9922 ssh tv ``` -------------------------------- ### Sensor Interval Example Response Source: https://webostv.developer.lge.com/develop/references/magic-remote Example of a successful response when retrieving sensor interval information. ```json { "minInterval": 10, "returnValue": true, "interval": 10, "maxInterval": 1000 } ``` -------------------------------- ### Sensor Data Example Response Source: https://webostv.developer.lge.com/develop/references/magic-remote Example of a successful response when canceling a sensor data subscription. ```json { "returnValue": true } ``` -------------------------------- ### List Available App Templates Source: https://webostv.developer.lge.com/develop/tools/cli-dev-guide Use this command to see all available templates for generating webOS TV apps and services. ```bash ares-generate --list ``` -------------------------------- ### Example Return: Subscription Success Source: https://webostv.developer.lge.com/develop/references/camera This JSON shows a successful response when using the subscription feature, indicating the list of devices and that subscription is enabled. ```json { 'returnValue': true, 'uriList': [ { 'uri': 'camera://com.webos.service.camera/camera1', 'type': 'camera' }, { 'uri': 'camera://com.webos.service.camera/mic1', 'type': 'microphone' } ], 'subscribed': true } ``` -------------------------------- ### Check App Installation Status Source: https://webostv.developer.lge.com/develop/references/application-manager Use this request to verify if a specific application is installed before attempting to launch it. ```javascript // One-time call // Checking app installation var request = webOS.service.request('luna://com.webos.applicationManager', { method: 'getAppLoadStatus', parameters: { appId: 'com.yourdomain.callee' }, onSuccess: function (inResponse) { if (inResponse.exist) { console.log('The app exists'); // To-Do something } else { console.log('The app does not exist'); // To-Do something } }, onFailure: function (inError) { console.log('Failed to check app installation'); console.log('[' + inError.errorCode + ']: ' + inError.errorText); // To-Do something return; }, }); ``` -------------------------------- ### Retrieve System Settings via webOS Service Source: https://webostv.developer.lge.com/develop/references/settings-service Examples demonstrating how to request various system settings such as country, locale, audio guidance, and caption information using webOS.service.request. ```javascript // Get country information var request = webOS.service.request('luna://com.webos.settingsservice', { method: 'getSystemSettings', parameters: { category: 'option', keys: ['country', 'smartServiceCountryCode2'], }, onSuccess: function (inResponse) { console.log('Result: ' + JSON.stringify(inResponse)); // To-Do something }, onFailure: function (inError) { console.log("Failed to get settings' value"); console.log('[' + inError.errorCode + ']: ' + inError.errorText); // To-Do something return; }, }); // Get locale information with subscription var subscriptionHandle; subscriptionHandle = webOS.service.request('luna://com.webos.settingsservice', { method: 'getSystemSettings', parameters: { keys: ['localeInfo'], subscribe: true, }, onSuccess: function (inResponse) { if (typeof inResponse.subscribed != 'undefined') { if (!inResponse.subscribed) { console.log("Failed to subscribe settings' value"); return; } } console.log('Result: ' + JSON.stringify(inResponse)); // To-Do something }, onFailure: function (inError) { console.log("Failed to get settings' value"); console.log('[' + inError.errorCode + ']: ' + inError.errorText); // To-Do something return; }, }); ... // Get audio guidance information var audioGuidanceRequest = webOS.service.request( 'luna://com.webos.settingsservice', { method: 'getSystemSettings', parameters: { category: 'option', keys: ['audioGuidance'], }, onSuccess: function (inResponse) { console.log('Result: ' + JSON.stringify(inResponse)); // To-Do something }, onFailure: function (inError) { console.log("Failed to get settings' value"); console.log('[' + inError.errorCode + ']: ' + inError.errorText); // To-Do something return; }, } ); // Get caption information var captionRequest = webOS.service.request('luna://com.webos.settingsservice', { method: 'getSystemSettings', parameters: { category: 'caption', keys: ['captionEnable'], }, onSuccess: function (inResponse) { console.log('Result: ' + JSON.stringify(inResponse)); // To-Do something }, onFailure: function (inError) { console.log("Failed to get settings' value"); console.log('[' + inError.errorCode + ']: ' + inError.errorText); // To-Do something return; }, }); // Get captionAnalog information var captionAnalogRequest = webOS.service.request( "luna://com.webos.settingsservice", { method: "getSystemSettings", parameters: { category: "caption", keys: ["captionAnalog"], }, onSuccess: function (inResponse) { console.log("Result: " + JSON.stringify(inResponse)); // To-Do something }, onFailure: function (inError) { console.log("Failed to get settings' value"); console.log("[" + inError.errorCode + "]: " + inError.errorText); // To-Do something return; }, }, ); // Get captionDigital information var captionDigitalRequest = webOS.service.request( "luna://com.webos.settingsservice", { method: "getSystemSettings", ``` -------------------------------- ### Example Return: One-time Call Success Source: https://webostv.developer.lge.com/develop/references/camera This is a sample success response for a one-time call to getList, showing connected camera and microphone devices. ```json { 'returnValue': true, 'uriList': [ { 'uri': 'camera://com.webos.service.camera/camera1', 'type': 'camera' }, { 'uri': 'camera://com.webos.service.camera/mic1', 'type': 'microphone' } ] } ``` -------------------------------- ### Example Success Return for getSystemInfo Source: https://webostv.developer.lge.com/develop/references/tv-device-information Illustrates a successful response from the `getSystemInfo` method, including the `returnValue` flag and the requested system properties. ```json // Success return { "returnValue" : true, "modelName" : "WEBOS1", "firmwareVersion" : "3.00.00", "UHD":"true", "sdkVersion":"1.05.00" } ``` -------------------------------- ### Stop Scan Failure Return Example Source: https://webostv.developer.lge.com/develop/references/ble-gatt This is an example of a failed return from the stopScan method, including error details. ```json { "returnValue": false, "errorCode": 101, "errorText": "Invalid JSON input" } ``` -------------------------------- ### Package App from Current Directory Source: https://webostv.developer.lge.com/develop/tools/cli-dev-guide Creates a package file from the specified app directory and outputs it in the working directory. Use this for basic packaging. ```bash ares-package sampleApp ``` -------------------------------- ### ares-setup-device CLI Source: https://webostv.developer.lge.com/develop/tools/webos-tv-cli-dev-guide Commands for managing target device configurations including listing, adding, modifying, and removing devices. ```APIDOC ## ares-setup-device ### Description Manages the list of target devices used for development and deployment. ### Commands - --list: List all configured target devices. - --add [NAME] -i [INFO]: Add a new target device. - --modify [NAME] -i [INFO]: Modify an existing target device. - --remove [NAME]: Remove a target device. - --search: Search for available webOS devices. - -f [DEVICE]: Set a specific device as the default. ``` -------------------------------- ### PlayReady Response XML Example Source: https://webostv.developer.lge.com/develop/references/drm Example of the XML structure returned in the result message for PlayReady DRM operations. ```xml 0 CID=abc ``` -------------------------------- ### Retrieve Device Information via getInfo Source: https://webostv.developer.lge.com/develop/references/camera Use these examples to request detailed information for either a camera or a microphone device using its URI. ```javascript // Example for camera device var request = webOS.service.request('luna://com.webos.service.camera', { method: 'getInfo', parameters: { uri: 'camera://com.webos.service.camera/camera1' }, onSuccess: function (inResponse) { console.log('Result: ' + JSON.stringify(inResponse)); // To-Do something }, onFailure: function (inError) { console.log('Failed to get camera device info'); console.log('[' + inError.errorCode + ']: ' + inError.errorText); // To-Do something return; }, }); // Example for microphone device var request = webOS.service.request('luna://com.webos.service.camera', { method: 'getInfo', parameters: { uri: 'camera://com.webos.service.camera/mic1' }, onSuccess: function (inResponse) { console.log('Result: ' + JSON.stringify(inResponse)); // To-Do something }, onFailure: function (inError) { console.log('Failed to get microphone device info'); console.log('[' + inError.errorCode + ']: ' + inError.errorText); // To-Do something return; }, }); ``` -------------------------------- ### Example DB8 Query Implementation Source: https://webostv.developer.lge.com/develop/guides/db8-usage A practical example of a query object filtering contacts by state with pagination and ordering. ```json { "select" : ["displayName", "state"], "from" : "com.yourdomain.contacts:1", "where" : [{"prop":"state","op":"=","val":"CA"}], "orderBy" : "displayName", "desc" : true, "incDel" : true, "limit" : 40, "page" : "BGhlbGxvAAs3" } ``` -------------------------------- ### Install webOS TV Plugin for Sublime Text Source: https://webostv.developer.lge.com/develop/tools/sublime-configuring-webos-tv-plugin Run the appropriate script for your operating system to manually install the plugin. ```shell /SublimePlugin/webOS_plugin_install_linux.sh ``` ```shell /SublimePlugin/webOS_plugin_install_mac.sh ``` ```batch \SublimePlugin\webOS_plugin_install.bat ``` -------------------------------- ### Monitor keyboard visibility and input events Source: https://webostv.developer.lge.com/develop/guides/system-ui-visibility A full HTML example demonstrating how to track keyboard visibility alongside standard input and key events. ```html
``` -------------------------------- ### Example First Response for Subscription Source: https://webostv.developer.lge.com/develop/references/tv-device-information Shows the initial response received when subscribing to system information changes. It includes the `returnValue` and indicates the subscription is active. ```json // Subscription example // First response { "returnValue" : true, ``` -------------------------------- ### Update Method Success Return Example Source: https://webostv.developer.lge.com/develop/references/keymanager3 Example of a successful return from the update method, including the consumed size and output. ```json { "returnValue": true, "consumed_size": 16, "output": "uvFYV8bL3EByEcswuUOYUg==" } ``` -------------------------------- ### Create Activities with webOS Service Request Source: https://webostv.developer.lge.com/develop/references/activity-manager Examples demonstrating how to create basic and scheduled activities using the webOS service request API. ```javascript // Create a basic activity var request = webOS.service.request('luna://com.palm.activitymanager', { method: 'create', parameters: { activity: { name: 'basicactivity', description: 'Test create', type: { foreground: true, }, }, start: true, subscribe: true, }, onSuccess: function (inResponse) { if (!inResponse.event) { console.log('The Activity is created'); // To-Do something } else { console.log('Received event: ' + inResponse.event); // To-Do something } }, onFailure: function (inError) { console.log('Failed to create the Activity'); console.log('[' + inError.errorCode + ']: ' + inError.errorText); // To-Do something return; }, }); ``` ```javascript // Create a scheduled activity var request = webOS.service.request('luna://com.palm.activitymanager', { method: 'create', parameters: { ``` -------------------------------- ### Get Revision Set Number Source: https://webostv.developer.lge.com/develop/guides/db8-usage Retrieves a record by its ID using the get() method to inspect its revision set number. ```javascript var id = '++HEIviIqT+9MYkj'; var ids = [id1]; var parameter = { ids: ids }; var request = new enyo.ServiceRequest(); request.service = 'luna://com.palm.db/get'; request.go(parameter); ``` -------------------------------- ### Create a Hosted Web App Source: https://webostv.developer.lge.com/develop/getting-started/web-app-types Execute this command to scaffold a hosted web app. This type involves a local dummy app that redirects to content hosted on a remote server. ```bash ares-generate -t hosted_webapp [your-project-name] ``` -------------------------------- ### Success Return - Audio Guidance Information Source: https://webostv.developer.lge.com/develop/references/settings-service Example of a successful response when retrieving audio guidance settings. ```json { "subscribed": false, "category": "option", "method": "getSystemSettings", "settings": { "audioGuidance": "off" }, "returnValue": true } ``` -------------------------------- ### Verify webOS CLI Version Source: https://webostv.developer.lge.com/develop/tools/cli-installation After installation, run this command to check if the webOS CLI is installed correctly and to see its current version. ```bash $ ares -V ```