[ https://issues.apache.org/jira/browse/CB-1269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13438906#comment-13438906 ]
Simon MacDonald commented on CB-1269: ------------------------------------- Hey Andrew, I think you mean to use: document.addEventListener('online', onLineEvent2, false); document.addEventListener('offline', onLineEvent2, false); If you switch to that you will get the events. The other thing you will run into is that navigator.onLine is always true in the Android WebView. That's a bug in the OS as near as I can tell. > navigator.onLine and related events never fire on Android > --------------------------------------------------------- > > Key: CB-1269 > URL: https://issues.apache.org/jira/browse/CB-1269 > Project: Apache Cordova > Issue Type: Bug > Components: Android > Affects Versions: 2.0.0 > Reporter: Andrew Grieve > Assignee: Andrew Grieve > > Discovered this when doing bridge testing. > function onLineEvent2(e) { > console.log('Got online=' + navigator.onLine); > } > window.addEventListener('online', onLineEvent2, false); > window.addEventListener('offline', onLineEvent2, false); > The events never fire when I put my phone in and out of airplane mode. I see > the following log: > 08-21 13:20:14.095: D/DroidGap(12652): onMessage(networkconnection,none) > But never get an online/offline event. > If I use setNetworkAvailable() manually, the events get fired as a result. > This leads me to believe that it's the app's responsibility to call this > setter in order for the events to be fired. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira