Windows Phone and PhoneGap – Article #7 – Check for Network Connections

If you want to find out the connection information of your Windows Phone using PhoneGap you can use the connection object .

The navigator.network.connection.type – lets the developers know about the currrent device’s connection states and in simple terms lets you know the type of connection , your Windows Phone is using .

You can find out if your Phone is using Wifi , cellular ( 2G/3G ) or ethernet connection .

function Button1_onclick()
{
var networkState = navigator.network.connection.type;
navigator.notification.alert(networkState);
}

The above sample code displays the message “UNKNOWN” when tried on emulator but displayed correctly ( Wifi / Cellular ) on my HTC Mozart 7 :)

 

Windows Phone and PhoneGap - Article #7 - Check for Network Connections

Windows Phone and PhoneGap - Article #7 - Check for Network Connections

 

Share