Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Titanium.Network.online reporting a false positive

The first line of my app.js reads,

Titanium.API.info('Titanium.Network.online: ' + Titanium.Network.online);

This prints out 'Titanium.Network.online: true', even if my WIFI is off (and I'm not plugged in). I am apparently getting a false positive on my device too. This is in sdk 1.3.1. Am I misusing the API or is it a bug you think?

— asked June 8th 2010 by Andrew Blair
  • connection
  • network
1 Comment
  • i have also same problem .Even if your WIFI is off it showing True.what i found is "Titanium.Network.networkTypeName" is mobile not WIFI.That means Titanium.Network.online based on mobile settings .it checking only mobile network neither WiFI nor LAN.

    — commented August 1st 2011 by Justin Mathew

1 Answer

  • I've tried this in an app.js (SDK1.3.1) :
    Titanium.API.info('Titanium.Network.online: ' + Titanium.Network.online);

    it gave me the right status :
    [INFO] Titanium.Network.online: false

    is it on iPhone or android?

    you can also use :
    if (Titanium.Network.networkType == Titanium.Network.NETWORK_NONE) {}

    — answered June 8th 2010 by Stephane Pelamourgues
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.