Cordova 'deviceready' event firing twice on wp8

531 views Asked by At

I'm developing a WP8 application in Cordova.

I already finished the app in Android and iOS, but on WP8 the 'deviceready' event is firing twice? :(

  • I tried to add a counter to ready, but the counter starts everytime on 0
  • I tried it with a var r = false and if ready is called set to true. But r stays false
  • I even tried a timer in ready with a random math. still nothing though

Still executing twice

  • Cordova version: 5.0.0
  • jQuery: 2.1.x
document.body.onload = onLoad;

function onLoad() {
    console.log('onload');
    document.addEventListener('deviceready', ready, false);
}

function ready(){
    console.log('ready'); //firing twice
}

The following cordova plugins are installed:

  • 2.4.0 "PushPlugin"
  • 1.0.0 "Console"
  • 2.4.0 "PushPlugin"
  • 1.0.0 "Console"
  • 1.0.0 "Device"
  • 1.0.0 "Notification"
  • 1.0.0 "Geolocation"
  • 1.0.0 "Globalization"
  • 1.0.0 "InAppBrowser"
  • 1.0.0 "Network Information"
  • 1.0.0 "Whitelist"
  • 1.2.0 "UniqueDeviceID"
  • 3.2.2 "Custom URL scheme"
  • 1.0.0 "Splashscreen"
  • 0.3.13 "Vibration"
  • 0.1.7 "AppVersion"

And at last the debug information: http://pastebin.com/8FgLnULJ

Hope you guys can help me because I can't figure it out.

If someone needs more information, just ask me :)

Thanks!

1

There are 1 answers

0
Dmitriy  Kolesnikov On BEST ANSWER

If you change console.log to alert then you will see that deviceready fired once... Console plugin for windows phone just doing duplicate of messages, try remove the plugin and you will see one message "ready"...