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

L Hobbs commented on CB-13730:
------------------------------

This issue seems to be related to the "Doze" mode added to Android in version 
6.0, but has gotten much worse with Android 7.0 and 8.0. Reference 
https://issues.apache.org/jira/browse/CB-12325 for a way to reproduce the 
steps. I have been able to build a very, very simple project 
([https://github.com/tciwebdev/cordova-bug] ) in PhoneGap Build, which uses 
cli-6.5.0 (4.3.1 / 6.1.2 / 4.4.3), and cordova-plugin-network-information 
version 2.01. The only way I've seen to get the test app I built to report that 
the network is online is to either kill the app and relaunch it, or to disable 
data/force the phone in to airplane mode and back out while the app is running. 
 The only other option is to go into the phone settings and disable battery 
optimization for the app but that's something the user has to do on their 
device. 

 

 

> cordova-plugin-network-information return wrong connection status on Android
> ----------------------------------------------------------------------------
>
>                 Key: CB-13730
>                 URL: https://issues.apache.org/jira/browse/CB-13730
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-plugin-network-information
>    Affects Versions: cordova@7.1.0
>         Environment: Windows 10, cordova-cli@7.1.0, cordova-android@6.4.0
>            Reporter: Cristian Iossi
>            Priority: Major
>              Labels: test
>
> There is a problem with cordova-plugin-network-information on Android. Even 
> if there is internet connection, after the app is opened for a while, when I 
> resume the app from the background and I check connection with 
> navigator.connection.type, it returns connection.type = NONE: I tried to do 
> an ajax request to verify the connection, and it works, so there is 
> connection. If I close and re-open the app it returns connection.type = 4G. I 
> use cordova@7.1.0 and cordova-android@6.4.0.
> My code to check the connection status is: 
> {code:java}
> function isOnline() {
>     var networkState = navigator.connection.type;
>     if (networkState !== Connection.NONE) {
>         return true
>     } else {
>         return false
>     }
> }
> {code}
> Thanks
> Cristian



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to