Cordova-WifiInfoPlugin icon indicating copy to clipboard operation
Cordova-WifiInfoPlugin copied to clipboard

deviceready not fireing

Open andricicezar opened this issue 10 years ago • 1 comments

I tried this plugin and deviceready is not firing.

Cordova: 3.5.0-0.2.4

Logs:

deviceready has not fired after 5 seconds.    cordova.js:1154
Channel not fired: onCordovaConnectionReady   cordova.js:1147

index.html

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
        <meta name="msapplication-tap-highlight" content="no" />
        <title>Hello World</title>

        <script type="text/javascript" src="cordova.js"></script>
        <script type="text/javascript" src="js/index.js"></script>
    </head>
    <body onload="app.initialize()">
        <input type="button" value="Scan" id="scan" />
        <input type="button" name="" id="Connect" value="connect" />

        <div id="list">
        </div>

    </body>
</html>

index.js:

var app = {
    // Application Constructor
    initialize: function() {
        this.bindEvents();
    },
    // Bind Event Listeners
    //
    // Bind any events that are required on startup. Common events are:
    // 'load', 'deviceready', 'offline', and 'online'.
    bindEvents: function() {
        document.addEventListener('deviceready', app.onDeviceReady, false);
    },
    // deviceready Event Handler
    //
    // The scope of 'this' is the event. In order to call the 'receivedEvent'
    // function, we must explicitly call 'app.receivedEvent(...);'
    onDeviceReady: function() {
        app.receivedEvent('deviceready');
    },
    // Update DOM on a Received Event
    receivedEvent: function(id) {
        var parentElement = document.getElementById(id);
        var scanButton = document.getElementById('#scan');
        var coonectButton = document.getElementById('#connect');

        scanButton.onclick = function() {
          window.wifi.refresh();
          alert(window.wifi.networks);
        };

        alert("Am intrat");
    }
};

Other installed plugins: org.apache.cordova.network-information 0.2.10 "Network Information"

andricicezar avatar Jul 08 '14 11:07 andricicezar

I am also getting this error. When I remove the plugin the error goes away...

lukepoulton avatar Apr 18 '16 13:04 lukepoulton