ondeviceready will only fire once when cordova is fully loaded. You will want to call the same function when different events occur like 'online' and 'offline'.:
// Device is ready let's do this
function onDeviceReady() {
checkConnection();
}
document.addEventListener("deviceready", onDeviceReady, false);
document.addEventListener("online", checkConnection, false);
document.addEventListener("offline", checkConnection, false);