Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8046323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:45:19+00:00 2026-06-05T05:45:19+00:00

I am using navigator.network.connection.type to get the network status of the device. But it

  • 0

I am using navigator.network.connection.type to get the network status of the device. But it shows the error

TypeError: Result of expression 'navigator.network' [undefined] is not an object.

I tried with Phonegap 1.0.0, Cordova 1.7.0, Cordova 1.7.0rc1, but I still get the same error.

It works fine on iOS but not on Android. Can someone help me with this?

Here is my code:

<script type="text/javascript" charset="utf-8">
    document.addEventListener("deviceready",onDeviceReady,false);

    function onDeviceReady() {
        checkConnection();
        loaddb();
    }
    function checkConnection() {
        alert(navigator.network);
        if(navigator.network==undefined) {
            window.localStorage.setItem("internetAccessFlag","false");
        } else {
            var networkState = navigator.network.connection.type;
            var states = {};
            states[Connection.UNKNOWN]  = 'Unknown connection';
            states[Connection.ETHERNET] = 'Ethernet connection';
            states[Connection.WIFI]     = 'WiFi connection';
            states[Connection.CELL_2G]  = 'Cell 2G connection';
            states[Connection.CELL_3G]  = 'Cell 3G connection';
            states[Connection.CELL_4G]  = 'Cell 4G connection';
            states[Connection.NONE]     = 'No network connection';

            if(networkState==Connection.UNKNOWN || networkState==Connection.NONE) {
                window.localStorage.setItem("internetAccessFlag","false");
            } else {
                window.localStorage.setItem("internetAccessFlag","true");   
            }
            //alert(window.localStorage.getItem("internetAccessFlag"));
        }
    }
</script>

EDIT:- I am using Cordova 1.7.0 and plugins.xml has

<plugin name="NetworkStatus" value="org.apache.cordova.NetworkManager"/>

Is there anything I have to do with this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T05:45:20+00:00Added an answer on June 5, 2026 at 5:45 am

    This is code that works perfectly well for me:

    <!DOCTYPE HTML>
    <html>
      <head>
          <script type="text/javascript" charset="utf-8" src="cordova-1.7.0.js"></script>
          <script type="text/javascript" charset="utf-8">
    
        var deviceInfo = function(){
          alert(navigator.network.connection.type);
        }
    
        function init(){
            console.log("GOT AN ONLOAD!!!")
            document.addEventListener("deviceready", deviceInfo, true);
        }
      </script>
      </head>
      <body onload="init();">
          A body...
      </body>
    </html>
    

    Also, when you moved from iOS to Android did you use the Android version of cordova.js? There is a platform dependent cordova.js for each platform.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using this function below to get the internet connection type function checkConnection()
I have PhoneGap-Android application and I want to check network connection type (No connection,
I'm recognising when a user is using certain phones using navigator.userAgent.match but with Android
Getting the information from the HTTP User-Agent header using navigator.userAgent in JavaScript we get
Using Navigator object you are able to get visitors browser info and history. Also
I can choose the navigator I want using ⌘ + 1 , ⌘ +
I am using the jQuery Tools Scrollable plugin - http://flowplayer.org/tools/scrollable.html#navigator I have created a
I'm using the navigator.geolocation.getCurrentPosition(function) api in firefox 3.6. When i try to call this
I have a problem in Determining Browsers. I've tried using navigator and well, it
I am embedding usercontrols in a panel and using DevExpress Navigator control to navigate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.