Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

phonegap navigator.connection is undefined

I've got a problem using Phonegap. I've created a Test application using console:

phonegap create ProjectTest

cordova platform add ios

cordova build

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

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

Also i've added this line to my config.xml:

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

So, result in alert is 'undefined'......

I just need to test the connection, using navigator.connection.type

Using MacBook and Xcode 4.6.3

like image 501
FetalDump Avatar asked Jul 26 '13 09:07

FetalDump


1 Answers

Same issue here. I was testing my code after these steps. create, add platform ios, add plugin blabla. When you do like this, its not working. You have to say

$ cordova build ios

or

$ phonegap build ios

after that, its creating new files about plugins and its working. Hope that help you too.

(cordova 3.3.0)

like image 163
Uğur Özpınar Avatar answered Oct 26 '22 18:10

Uğur Özpınar