com.webos.service.webappmanager

API Summary

Internal system service for handling web-based (HTML) applications.

The Web App Manager (WAM) is a component responsible for web application management in webOS platform. The Application Manager (SAM) sends a request to manage web applications to WAM.

WAM handles basic routines such as launching, closing apps as well as the following features of web applications.

  1. Running lists
  2. Life cycles
  3. Current status of applications
  4. Application crash

Overview of the API

(click to expand)

See Summary.


Open All


closeAllApps

Description

Close all currently running applications.

Parameters

None

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of operation. Possible values are:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed.

Example

# luna-send -n 1 luna://com.webos.service.webappmanager/closeAllApps "{}"


closeByProcessId

Description

Close an application using the internal associated processId.

Parameters

Name

Required

Type

Description

processIdRequirednumber

The id of process to close.

Call Returns

Name

Required

Type

Description

returnValueRequiredboolean

Indicates the status of operation. Possible values are:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed. 
appIdOptionalstring

The id of closed app.

processIdOptionalnumber

The id of closed process.

errorTextOptionalstring

Indicates the reason for the failure of the operation.

Example

# luna-send -n 1 luna://com.webos.service.webappmanager/closeByProcessId "{\"processId\":\"1008\"}"

Returns:

{

    "appId": "accuweather",

    "processId": "1008",

    "returnValue": true

}


getWebProcessSize

Description

Get the size of current running WebProcess.

Parameters

None

Call Returns

Name

Required

Type

Description

pid Required Number

The id of process.

webProcessSize Required Number

The size of the process in KB.

tileSize Required Number

The size of the tile in KB.

runningApps Required String array

List of apps which the process is running.

returnValue Required Boolean

returnValue will contain true.

Example

# luna-send -n 1 luna://com.webos.service.webappmanager/getWebProcessSize "{}"

Returns:

{

    "WebProcesses": [

    {

        "pid": "4252",

        "runningApps": [

        {

            "id": "com.webos.app.guide"

        }

        ],

        "tileSize": 0,

        "webProcessSize": "83924 kB"

    },

    {

        "pid": "4294",

        "runningApps": [

        {

            "id": "accuweather"

        }

        ],

        "tileSize": 0,

        "webProcessSize": "65832 kB"

    },

    {

        "pid": "4280",

        "runningApps": [

        {

            "id": "com.webos.app.container"

        }

        ],

        "tileSize": 0,

        "webProcessSize": "67444 kB"

    }

    ],

    "returnValue": true

}


killApp

Description

Kill all windows owned by the specified app. This is intended to be used by SAM if necessary.

Parameters

Name

Required

Type

Description

appId Required string

The id of app to kill.

Call Returns

Name

Required

Type

Description

returnValue Required boolean

Indicates the status of operation. Possible values are:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed. 
errorText Optional string

Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details.

appId Optional string

The id of killed app.

Example

# luna-send -n 1 luna://com.webos.service.webappmanager/killApp "{\"appId\":\"com.mycom.app.viewster\"}"

Returns:

{

    "appId": "com.mycom.app.viewster",

    "returnValue": true

}


launchApp

Description

Launch an application by app id. This is the major function used by SAM to request launching an application.

Parameters

Name

Required

Type

Description

appDesc Required string

JSON object containing the appinfo.json parameters determined by SAM.

parameters Optional string

JSON object containing the parameters to pass to the app.

launchingAppId Optional string

The id of launching app.

launchingProcId Optional number

The id of process launching the app.

Call Returns

Name

Required

Type

Description

appId Required string

The id of the launched app. The app is launched according to the properties specified in the appDesc parameter.

procId Required number

The id of process assigned to this launch.

errorText Optional string

Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details.

returnValue Optional Boolean

Indicates the status of operation. Possible values are:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed.

listRunningApps

Description

Return a list of applications that Web App Manager is running. This method can be subscribed.

Parameters

Name

Required

Type

Description

subscribe Optional boolean

​Subscribe for notifications. Possible values are:

  • true - Get notifications
  • false - Notifications are not required

Default value: false

includeSysApps Optional boolean

Includes/excludes system applications in the running app list.Possible values are:

  • true: To include system applications in the running app list.
  • false: To exclude system applications from the running app list.

Default value: false.

Call Returns

Name

Required

Type

Description

running Required String array

Array of all running apps. Each app will be returned in the form of {"id": appId, "processId": processId, "webprocessid": weprocessid}.

returnValue Required boolean

returnValue will always contain true.

Subscription Returns

Name

Required

Type

Description

running Required String array

   Array of all running apps. Each app will be returned in the form of {"id": appId, "processId": processId, "webprocessid": weprocessid}.   

returnValue Required Boolean

returnValue will always contain true.

subscribed Required Boolean

Indicates if subscribed.

  • true - Subscribed for changes
  • false - Not subscribed

Example

Example 1:

# luna-send -n 1 luna://com.webos.service.webappmanager/listRunningApps "{}"

Returns:

{

    "returnValue": true,

    "running": [

    {

        "id": "com.webos.app.guide",

        "processid": "1006",

        "webprocessid": "4252"

    },

    {

        "id": "accuweather",

        "processid": "1008",

        "webprocessid": "4294"

    }

    ]

}

 

Example 2:

# luna-send -n 1 luna://com.webos.service.webappmanager/listRunningApps "{\"includeSysApps\":true}"

Returns:

{

    "returnValue": true,

    "running": [

    {

        "id": "com.webos.app.guide",

        "processid": "1006",

        "webprocessid": "4252"

    },

    {

        "id": "accuweather",

        "processid": "1008",

        "webprocessid": "4294"

    }

    ]

}

 

Example 3:

# luna-send -n 1 luna://com.webos.service.webappmanager/listRunningApps "{\"subscribe\":true}"

Returns:

{

    "returnValue": true,

    "running": [

    {

        "id": "youtube.leanback.v4",

        "processid": "1002",

        "webprocessid": "2618"

    }

    ],

    "subscribed": true

}


logControl

Description

Enable or disable whether to show logs with associated keys.

Parameters

Name

Required

Type

Description

keysOptionalString

Keys to determine which log to enable.

valueOptionalString

To show log of specified key, set value to "on".

To hide log of specified key, set value to "off".

Call Returns

Name

Required

Type

Description

eventRequiredBoolean

Indicates whether event logs are shown or not. Possible values are:

  • true: If enabled to show event logs.
  • false: If disabled to show event logs.
bundleMessageRequiredBoolean

Indicates whether bundleMessage logs are shown or not.

  • true: If enabled showing bundleMessage logs.
  • false: If disabled showing bundleMessage logs.
mouseMoveRequiredBoolean

Indicates whether mouseMove logs are shown or not.

  • true: If enabled showing mouseMove logs.
  • false: If disabled showing mouseMove logs.
returnValueOptionalBoolean

Indicates the status of operation. Possible values are:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed.

Example

# luna-send -n 1 luna://com.webos.service.webappmanager/logControl "{\"keys\":\"event\",\"value\":\"on\"}"

Returns:

{

    "bundleMessage": false,

    "event": true,

    "mouseMove": false

}


webProcessCreated

Description

Return the process id of launched application. This method can be subscribed.

Parameters

Name

Required

Type

Description

appIdRequiredString

The id of the launched application.

subscribeOptionalBoolean

​Subscribe for notifications. Possible values are:

  • true - Get notifications
  • false - Notifications are not required

​​Default value: false

Call Returns

Name

Required

Type

Description

idOptionalString

The id of the launched application.

errorTextOptionalString

Indicates the reason for the failure of the operation.

returnValueOptionalBoolean

Indicates the status of operation. Possible values are:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed.
webprocessidOptionalNumber

The process id of the launched application.

Subscription Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of operation. Possible values are:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed.
subscribedOptionalBoolean

Indicates if subscribed to get notified.

  • true - Subscribed for changes
  • false - Not subscribed

Example

# luna-send -n 1 luna://com.webos.service.webappmanager/webProcessCreated "{\"appId\":\"accuweather\"}"

Returns:

{

    "id": "accuweather",

    "returnValue": true,

    "webprocessid": 4865

}


clearBrowsingData

Description

Clears browsing data of a specific type.

Parameters

Name

Required

Type

Description

types Optional String array

Type of browsing data to be deleted. Possible values are:

  • all (includes browsing data of all other specified types)
  • appcache
  • cache
  • codecache
  • cookies
  • fileSystems
  • localStorage
  • channelIDs
  • serviceWorkers
  • cacheStorage
  • webSQL

Note: If no value is provided, by default, the method deletes all browsing data.

Call Returns

Name

Required

Type

Description

returnValue Required Boolean

Indicates the status of operation. Possible values are:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
errorCode Optional Number

The error code for the failed operation.

errorText  Optional String

Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details.

Error References

Error Code

Error Text

Error Description

3000 Empty array is not allowed.

Occurs because value of array type for "types" parameter is not specified. It means that the array is defined but the length is 0.

3001 Invalid value (Only allowed for string type)

Occurs because data type of "types" parameter is wrong. Only string array is possible. 

3002 Unknown data: [wrong value]

Occurs because value of 'types' parameter is unknown data. Refer to possible values specified in the parameter section.

Example

Example 1: Clear all browsing data

- Using the "all" value for the "types" parameter

# luna-send -n 1 luna://com.webos.service.webappmanager/clearBrowsingData '{"types":["all"]}'

 

- Without specifying the "types" parameter

# luna-send -n 1 luna://com.webos.service.webappmanager/clearBrowsingData '{}'

 

Example 2: Clear specific browsing data

- Clears localstorage type browsing data

# luna-send -n 1 luna://com.webos.service.webappmanager/clearBrowsingData '{"types":["localStorage"]}'

 

- Clears localstorage and cache types of browsing data

# luna-send -n 1 luna://com.webos.service.webappmanager/clearBrowsingData '{"types":["cache", "localStorage"]}'


Except as noted, this content is licensed under Creative Commons Attribution 4.0 and sample code is licensed under Apache License 2.0.