1 Reply Latest reply on Apr 18, 2011 11:23 AM by jonbcampos

    Checking internet connectivity on android / IOS

    naknike Level 1

      Is there a popular way to check if a phone is currently able to connect to the internet (either wifi or 3g)?  I have been playing around with this, and the only way I have seens so far is to use try to load a webpage and set an httpResponse event listener.  This will return either "202" for connecting to the page or a "404" if the page doesn't exist.  The problem though is that doesn't actually check for an internet connection.  It just checks if that particular page is loadable.  In fact, when I have my android phone on airplane mode, the httpResponse doesn't fire at all.


      So is there a better, easier way to give me a simple true / false if I am connected catered specifally to mobile?

        • 1. Re: Checking internet connectivity on android / IOS
          jonbcampos Level 1

          "The best way to check for internet connectivity is to make a request." ~Christian Cantrell


          I know this seems like circular logic but I went to Christian with the same question and his answer makes sense. With all the different ways to connect, security and protocols the easiest way to check for connection is to make a call. If it fails, you can handle the response as appropriate.


          Just checking for the capability to access the internet (like you do with geolocation and the like) isn't very helpful.