Phonegap navigator.connection undefined

I have a problem with Phonegap . I created a test application using the console:

 phonegap create ProjectTest cordova platform add ios cordova build 

Then we opened the generated Xcode project and added a new line to the onDeviceReady function:

 onDeviceReady: function() { app.receivedEvent('deviceready'); // MY TEST alert(navigator.connection); } 

I also added this line to my config.xml file:

 <plugin name="NetworkStatus" value="CDVConnection" /> 

So, the result in the warning: "undefined" ...

I just need to check the connection using navigator.connection.type

Using MacBook and Xcode 4.6.3

+6
ios cordova connection navigator
source share
3 answers

Same problem. After these steps, I tested my code. create, add ios platform, add blabla plugin. When you do, it does not work. You have to say

 $ cordova build ios 

or

 $ phonegap build ios 

after which it creates new files about plugins and works . Hope this helps too.

(cordova 3.3.0)

+3
source share

I had a similar problem and was able to answer my question after several studies.

See this https://stackoverflow.com>

+1
source share

You must add the plugin first

+1
source share

All Articles