Ever wanted to know if a connection the internet exists before executing some script? Whether it’s downloading a remote image, posting a high score or anything else which requires a connection to the internet. Always give the user some feedback, use the activity indicator & a connection test rather than leaving the user guessing if something is happening.

Rather than using the Titanium.Network.online syntax (which can produce false positives) just check if the network is not available:

if (Titanium.Network.networkType === Titanium.Network.NETWORK_NONE) {
   Titanium.API.info(' no connection ');
} else {
   Titanium.API.info(' connection present ');
}

[source]