I am working on a telephone (using 2.7), and I am having problems with an online and offline event. It seems to be not working as indicated in the docs.
My code is to call the deviceready event.
function init(){ document.addEventListener('deviceready', arrangeConnectionListener, false); } function arrangeConnectionListener(){ document.addEventListener('online', onOnline, false); document.addEventListener('offline', onOffline, false); } $(document).ready(init);
However, the functions of the listeners do not start. I tried to put a delay in calling online listeners (1500 ms), but still to no avail. I also tried placing the console log inside the deviceConnectionListener to ensure that the deviceready event occurs.
Does anyone have an idea on a workaround or have this problem?
Thanks!
source share