cordova 3.0: Android: Connection is not defined

前端 未结 14 1573
情话喂你
情话喂你 2020-12-20 13:54

my first time experimenting with Apache Cordova 3.0.

downloaded lib, unziped cordova-android and cordova-js and created a project:

./create ~/Docume         


        
相关标签:
14条回答
  • 2020-12-20 13:59

    I am playing with the same thing and I think you need to install the features using this page by the use of cordova CLI.

    0 讨论(0)
  • 2020-12-20 14:02

    for me adding the plugin was not enough and didn't solve my issue...

    Then I did in the CLI after I added the plugin

    $ cordova build
    

    and everything worked perfectly ! Make sure your /www file has the updated files because it will be used to erase the platforms/xxx/www files

    0 讨论(0)
  • 2020-12-20 14:03

    I face the same problem, searching about this issue I found this question. I try many ideas, but the one did works was: 1- uninstall the network-information plugin 2- in the CMD -> cordova build 3- Install the plugin again 4- Build again.

    After this The connection example works fine.

    0 讨论(0)
  • 2020-12-20 14:06

    I'm using cordova 3.4.1 adding the plugin org.apache.cordova.network-information it fix my problem, try this:

    cordova plugin add org.apache.cordova.network-information

    I did not change any part of the code, as the help says:

    https://github.com/apache/cordova-plugin-network-information/blob/master/doc/index.md

    0 讨论(0)
  • 2020-12-20 14:11

    I had the same exact problem, but was able to fix it. Running the below commands as per the Phonegap Connection docs doesn't seem to work:

    $ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information.git
    $ cordova plugin rm org.apache.cordova.core.network-information
    

    Instead, I had to use:

    $ phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information.git
    

    Once I did that, it worked.

    0 讨论(0)
  • 2020-12-20 14:14

    I had the same problem with PhoneGap 3.5.0:navigator.connection.typereturned me0(unknown connection) andnavigator.onLine(from HTML5) wastrue` all the time.

    The problem was caused by the phone (probably I have too old Android version on my phone) because it works with emulator and with tablet (where is Android 4.2) correctly :-(

    0 讨论(0)
提交回复
热议问题