webOSDev API
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.
Methods
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. |
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.
Parameters
Name | Type | Description | required | ||||||
---|---|---|---|---|---|---|---|---|---|
type | String | The DRM type to be set to the DRMAgent instance Properties
| 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.
Parameters
Name | Type | Description | required | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
parameters | Object | The JSON object containing an app ID, parameters, callback handlers Properties
| Yes |
Success Callback Returns
None
Failure Callback Returns
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
error | Object | The JSON Object containing DRM service's error details. Properties
|
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.
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.
Parameters
Name | Type | Description | Required | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
parameters | Object | The JSON object Properties
| Yes |
Success Callback Returns
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
info | Object | The JSON Object containing the device ID. Properties
|
Failure Callback Returns
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
info | Object | The JSON Object containing UDID error details. Properties
|
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.
Parameters
Name | Type | Description | Required | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
parameters | Object | The JSON object containing handlers Properties
| Yes |
Success Callback Returns
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
response | Object | The JSON object containing the service's response data related to the network connection. Properties
|
Failure Callback Returns
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
info | Object | The JSON Object containing the error details. Properties
|
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