Search code examples
javascriptjquerycordovaonsen-uionsen-ui2

Onsen UI - 'init' event not firing in Android 4.1, 'show' event works fine


I tried adding the event listener in every possible place, inline javascript, $(document).ready and onDevideReady function for Cordova, the 'init' event never seems to fire in this version of Android. The funny thing is that the 'show' fires just fine...

here's code:

onDeviceReady: function () {
        document.addEventListener('show', myOnsen.onShowEvent);
        document.addEventListener('init', myOnsen.onInitEvent);
}

The event listeners are identical, and the init still dont fire. I've looked through their documentations, but there is nothing regarding older Android version.

Anyone else who had such problems? How can I solve this?


Solution

  • This problem is solved by using the Crosswalk engine plugin of Cordova, it changes something with the WebView when compiling the app, and now it works fine.

    To solve it, simply add Crosswalk plugin to your application, and Onsen UI will work on Android 4.4 and below without any other changes on code.