Hi,
I am working on a Tizen tv web application where I need to check if it is connected to the network or not. I tried samples given on samsungDforums but they are not showing me the correct result.
Following is the code which I tried to use:
var myInterval = setInterval(function () {
if(webapis.network.getGateway() !== null){
console.log("network is ok");
alert("network is ok.");
}else{
alert("您的设备目前已和网络断开, 请查看您的网络后重新尝试连接.");
}
},30000);
Even when I switch off the wifi on the tv or on my system while running the emulator, it always tells me the network is ok.
If I use the following(as given in the sample code site):
// Check network connection var myInterval = setInterval(function () { if(Network.getGateway()!=null){ document.getElementById('ep').style.display='inline'; //Network error message in pop up document.getElementById('ErrorPopUp').innerHTML="No Network Found"; }else{ document.getElementById('ep').style.display='none'; } },1000);
It still doesn't give me the correct result.
I'll appreciate if someone can help me in this. Thanks in advance!