Sartheris Stormhammer Sartheris Stormhammer - 1 year ago 94
Javascript Question

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,

function for Cordova, the
event never seems to fire in this version of Android. The funny thing is that the
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?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download