MIT App Inventor code snippet to verify an Internet connection with the use of Android’s webviewer function

16 Replies to “MIT App Inventor code snippet to verify an Internet connection with the use of Android’s webviewer function”

  1. Hi, I currently have success with this code having created an .apk app inventor 2, however it does not run on a Samsung S5 running KitKat? It does work on a Note3, upgraded to KitKat 4.4.2

    1. Good day Grant,

      Results may vary depending on the type of mobile phone and/or Android version, I concur. This may be caused by a 302 redirection. Hence, modify the ‘if’ statement to “get responseCode=200 or get responseCode=302″ and it should work properly…

      200 or 302 app inventor


        1. Hi Grant,

          Can you try one last thing?

          Modify “googleUrl=” to “googleUrl=”…

          Does it work properly after that modification?


  2. Hi,

    I just looked over your guide on how to check if there is sufficient connection to locate a position on a map (google maps). Surely I need to identify if the phone’s GPS is on and the phone has a data connection. Is it possible to check the data connection without opening the google webpage. Would it be advisable to change the google homepage to the google maps page?

    Many thanks,


    1. Good day Jamie,

      For the GPS, you may want to visit this website for more info:!topic/appinventor/F0CzHnf1wIY. This may also be helpful:

      For the data connection, my method works well with the google webpage… the important thing is to select a website that is normally online all the time (Google, Amazon, CNN, etc…); hence, feel free to change the googleUrl to another website that would be usually online at any moment… the google maps page would be fine.

      GoogleUrl Entry

      googleUrl =

      Best regards.

      Robert Radford

  3. Very good blog! Do you have any helpful hints for aspiring writers?
    I’m hoping to start my own blog soon but I’m a little lost on everything.
    Would you recommend starting with a free platform like WordPress or go for a paid option?
    There are so many options out there that I’m totally confused ..
    Any tips? Many thanks!

    1. Good day,

      If you are new to blogging, I would recommend you create your first blog using free online platforms (such as Weebly or Wix). You could also host your own website by registering your domain on Bluehost or any web hosting company. Once your website and domain are registered, you’ll be able to use WordPress as your content management system (most web hosting companies offer WordPress in their bundles… check it out, though). You could also use WordPress as a free option but you would then have an url given by WP. It’s up to you to decide which option you prefer.

      Best regards.


  4. I am new to MIT App Inventor and trying to create a project but i am not able to write the above code so can you plz send me your aia file

Comments / Commentaires