Here is the JavaScript code snippet to find the Internet connection type in an Intel XDK app.
if(intel.xdk.device.connection == "ethernet")
{
//ethernet
}
else if(intel.xdk.device.connection == "wifi")
{
//wifi
}
else if(intel.xdk.device.connection == "cell")
{
//cell
}
else if(intel.xdk.device.connection == "none")
{
//no internet is available
}
else if(intel.xdk.device.connection == "unknown")
{
//determining connection type. Till now its unknown. You should check for it later again.
}
else
{
//some other connection type.
}
alert(intel.xdk.device.connection);
},false);
intel.xdk.device.updateConnection();