Phonegap Network Connection - Cannot read property 'type' of undefined

You want to use the plugin found here: http://build.phonegap.com/plugins/626

<gap:plugin name="org.apache.cordova.network-information" version="0.2.7" />

I have posted this idea here already: https://stackoverflow.com/a/19319817/2390075

What i have noticed is that networkState doesn't get always initialised immediately. So what worked for me is adding a small delay after checking the state first and then checking it again, in your case it should look like this:

var networkState = navigator.connection && navigator.connection.type;

setTimeout(function(){
    networkState = navigator.connection && navigator.connection.type;

    var states = {};
    states[Connection.UNKNOWN]  = 'Unknown connection';
    states[Connection.ETHERNET] = 'Ethernet connection';
    states[Connection.WIFI]     = 'WiFi connection';
    states[Connection.CELL_2G]  = 'Cell 2G connection';
    states[Connection.CELL_3G]  = 'Cell 3G connection';
    states[Connection.CELL_4G]  = 'Cell 4G connection';
    states[Connection.NONE]     = 'No network connection';

    $("#system_popup").html('Connection type: ' + states[networkState]);
    $("#system_popup").popup("open")
    //alert('Connection type: ' + states[networkState]);
}, 500);