webOSDev

The webOSDev API provides methods for device information, digital right management (DRM), and app launch.

Most methods of webOSDev API are newly added, especially for webOS TV. 

Type

Name

Description

Member

APP

Holds properties representing the list of built-in apps opened on the webOS TV.

DRM

Holds properties that represent the DRM error number and the DRM type.

Method

drmAgent

Returns DRMAgent instance of a specific DRM type.

launch

Launches an application with parameters.

launchParams

Passes parameters when an app is being launched after webOS.launch is called.

LGUDID

Returns a device ID provided by the webOS TV ( LGUDID ) since webOS TV 3.0.

connection.getStatus

Returns the network connection state.

 

Open


APP

Description

A member representing the list of built-in apps on the webOS TV opened to external developers.

Properties

Name

Type

Description

BROWSER

String

The built-in browser on the webOS TV

Example

// You can launch webOS browser application.
webOSDev.launch({
    id: webOSDev.APP.BROWSER,
    params: {
        target: 'http://www.your-web-page.com', // target should be
    },
    onSuccess(res) {
        // do something
    },
    onFailure(res) {
        // handle error
    }
});

See Also

  • None

DRM

Description

An object containing properties that represent the DRM error number and the DRM type. 

Properties

Name

Type

Description

Error

DRMError

The error number from DRM service

Type

DRMType

The type of DRM

See Also

  • None

drmAgent

Description

Returns DRMAgent instance of a specific DRM type.

For more details of DRMAgent, see DRMAgent.

Syntax

webOSDev.drmAgent(type)

Parameters

Name

Type

Description

required

type

String

The DRM type to be set to the DRMAgent instance

Properties

Name

Type

Description

PLAYREADY

String

PlayReady

WIDEVINE

String

Widevine

Yes

Call Returns

Returns the Instance of DRMAgent.

Example

var drmagent;
drmagent = webOSDev.drmAgent(webOSDev.DRM.Type.PLAYREADY);

See Also

  • None

launch

Description

Launches an application with parameters.

Syntax

webOSDev.launch(parameters)

Parameters

Name

Type

Description

required

parameters

Object

The JSON object containing an app ID, parameters, callback handlers

Properties

Name

Type

Description

id

String

The app ID or webOSDev.APP

params

Object

The JSON data object to pass when launching an app

onSuccess

Function

The callback function called when the method succeeds.

onFailure

Function

The callback function called when the method fails. 

Yes

Success Callback Returns

None

Failure Callback Returns

Name

Type

Description

error

Object

The JSON Object containing DRM service's error details.

Properties

Name

Type

Description

errorCode

String

The error code returned when the method fails.

errorText

String

The error text returned when the method fails.

Call Returns

Returns undefined.

Example

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

See Also


launchParams

Description

Passes parameters of an app launched by the webOSDev.lauch method.

The parameters are usually delivered when the webOSLaunch event or webOSRelaunch event occurs. This method can be used to get the parameters from elsewhere where those events don't occur.

Syntax

webOSDev.launchParams()

Parameters

None

Call Returns

Name

Type

Description

params

Object

Parameters passed to the app

Example

var params = webOSDev.launchParams();
if (params) {
    console.log(params.userId + ' wants to access to page ' + params.page);
}

See Also


LGUDID

Description

Returns a device ID provided by the webOS TV since webOS TV 3.0.

Syntax

webOSDev.LGUDID(parameters)

Parameters

Name

Type

Description

Required

parameters

Object

The JSON object

Properties

Name

Type

Description

onSuccess

Function

The callback function called when the method succeeds.

onFailure

Function

The callback function called when the method fails. 

Yes

Success Callback Returns

Name

Type

Description

info

Object

The JSON Object containing the device ID.

Properties

Name

Type

Description

id

String

LG unique device ID.

Failure Callback Returns

Name

Type

Description

info

Object

The JSON Object containing UDID error details.

Properties

Name

Type

Description

errorCode

String

The error code returned when the method fails.

errorText

String

The error text returned when the method fails.

Callback Returns

Returns undefined.

Example

webOSDev.LGUDID({
    onSuccess: function (res) {
        // user device from server
        if (res.id === user.device) {
            // do something
        }
    },
    onFailure: function (res) {
        // API calling error
    }
});

See Also

  • None

connection.getStatus

Description

Returns the network connection state.

Syntax

webOSDev.connection.getStatus(parameters)

Parameters

Name

Type

Description

Required

parameters

Object

The JSON object containing handlers

Properties

Name

Type

Description

Required

onSuccess

Function

The callback function called when the method succeeds.

Yes

onFailure

Function

The callback function called when the method fails.

Yes

subscribe

Boolean

Indicates whether to subscribe the network connection status.

  • true: Subscribe the network connection status.

  • false: Not subscribe the network connection status.

Yes

Yes

Success Callback Returns

Name

Type

Description

response

Object

The JSON object containing the service's response data related to the network connection.

Properties

Name

Type

Description

isInternetConnectionAvailable

Boolean

Indicates whether the internet connection is available.

true: The internet connection is available.

false: The internet connection is unavailable.

wired

Object

The object that contains information about the state of the wired connection.

See the detail here.

wifi

Object

The object that contains information about the state of the WiFi connection.

See the detail here.

wifiDirect

Object

The object that contains information about the state of the WiFi direct connection.

See the detail here.

Failure Callback Returns

Name

Type

Description

info

Object

The JSON Object containing the error details.

Properties

Name

Type

Description

errorCode

String

The error code returned when the method fails.

errorText

String

The error text returned when the method fails.

Callback Returns

Returns undefined.

Example

webOSDev.connection.getStatus({
    onSuccess: function (res) {
        if (res.isInternetConnectionAvailable === false) {
            // pop up network error message
        } else {
            if (res.wired) {
                // do something
            } else if (res.wifi) {
                // do something
            }
        }
    },
    onFailure: function (res) {
        // API calling error
    },
    subscribe: true
});

See Also

  • None

Navigation