[ 
https://issues.apache.org/jira/browse/CB-842?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13288673#comment-13288673
 ] 

Simon MacDonald commented on CB-842:
------------------------------------

Okay, first thing is that "navigator.onLine" will always report true when 
running from a WebView. Since PhoneGap uses a WebView you will always get true 
so you can't count on this navigator property to give you proper network status.

Now, I know that when Android devices transition from 3G to wifi and vice versa 
they are offline for a short period of time. We actually wait 500 ms before 
sending the offline event so we can check that we are still offline and and a 
network connection has not be setup. My advice to you is to do a setTimeout in 
your isOfflineAfterOfflineEvent method to wait X number of ms and then check 
the value of navigator.network.connection.type to see if it has been updated.
                
> Offline event fired without special reasons
> -------------------------------------------
>
>                 Key: CB-842
>                 URL: https://issues.apache.org/jira/browse/CB-842
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 1.7.0
>            Reporter: Aurelien MERCIER
>
> The event is fired whereas I'm connected to wifi. Putting some logs in 
> offline method, I see that navigator.network.connection.type is NONE and 
> navigator.onLine is true.
> Ps: it seems it appears after loading a page...
> Right now I've added extra test in offline method to be sure it has been 
> called whereas there is really no connection available.

--
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

        

Reply via email to