Required platform API to know the internet status (Down/Up) when wifi/ethernet is connected

Hi, We are implementing the Webos Smart TV app. To identify the internet status when wifi/ethernet is connected, we are using the below API. If internet down also it is going to the onSuccess case. Could you please share the Webos platform API to get the internet status.

webOSDev.connection.getStatus({
onSuccess: function (res) {
},

onFailure: function (err) {
},
subscribe: true,
})

Verification Scenario:

  1. TV is connected with wifi
  2. Switched off/disabled the internet in the wifi router & wifi remains be on
  3. The above API returning response as true.

Have you checked res.wifi.state? If the WiFi connection is not available, this will be set to disconnected. Thank you.

Thanks for your reply. We would like to check the internet status not wifi status.

The scenario is, TV is connected to wifi & wifi does not have the internet. This situation, we would like to know in the application level using LG platform API’s. Kindly let me know if you need more details.

You can refer to Connection Manager API. Thank you.

Thank you very much for your reply. As per your suggestion we used the below API, if internet is available or not always it is providing the same response/result.

var request = webOS.service.request(‘luna://com.palm.connectionmanager’, {
method: ‘getStatus’,
onSuccess: function (inResponse) {
console.log(‘Result: ’ + JSON.stringify(inResponse));
// To-Do something
},
onFailure: function (inError) {
console.log(‘Failed to get network state’);
console.log(’[’ + inError.errorCode + ']: ’ + inError.errorText);
// To-Do something
return;
},
});

API response:
{
“cellular”: {
“enabled”: false
},
“returnValue”: true,
“offlineMode”: “disabled”,
“wired”: {
“plugged”: false,
“state”: “disconnected”
},
“wifi”: {
“netmask”: “255.255.255.0”,
“dns1”: “192.168.1.1”,
“ipAddress”: “192.168.1.27”,
“isWakeOnWifiEnabled”: false,
“proxyinfo”: {
“method”: “direct”
},
“onInternet”: “yes”,
“method”: “dhcp”,
“ssid”: “Test_5G”,
“displayName”: “Test_5G”,
“state”: “connected”,
“gateway”: “192.168.1.1”,
“checkingInternet”: false,
“interfaceName”: “wlan0”
},
“subscribed”: false,
“bluetooth”: {
“tetheringEnabled”: false,
“state”: “disconnected”
},
“wan”: {
“connected”: false,
“connectedContexts”: [

]
},
“wifiDirect”: {
“state”: “disconnected”
},
“isInternetConnectionAvailable”: true
}