https://issues.apache.org/jira/browse/CB-12035 && https://github.com/apache/cordova-plugin-network-information/issues/64: in case of TYPE_NONE (android bug?) return TYPE_UNKNOWN if ConnectivityManager.EXTRA_NO_CONNECTIVITY from the intent return false.
<!-- Please make sure the checklist boxes are all checked before submitting the PR. The checklist is intended as a quick reference, for complete details please see our Contributor Guidelines: http://cordova.apache.org/contribute/contribute_guidelines.html Thanks! --> ### Platforms affected android (6+) ### What does this PR do? There is an Android bug that returns a null activeNetworkInfo after idle time when there is a connection. This PR solves it by using the EXTRA_NO_CONNECTIVITY flag from the receiver Intent. In case the EXTRA_NO_CONNECTIVITY returns false, but the activeNetworkInfo is null, the network type is set to 'unknown'. (@see https://developer.android.com/reference/android/net/ConnectivityManager.html#EXTRA_NO_CONNECTIVITY ) The receiver is also removed in the onPause and reattached in the onResume (this is not backwards compatible). ### What testing has been done on this change? Thoroughly testing on my Samsung device. An extract from my logging (type none, but switched to unknown because 'no connectivity' was false: ` 09-26 22:20:13.483 25806-25806/appId D/NetworkManager: Connection Type: none Connection Extra Info: null ` ` 09-26 22:20:13.484 25806-25806/appId D/NetworkManager: Intent no connectivity: false !!! Switching to unknown ` ### Checklist - [x] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database - [x] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected. - [ ] Added automated test coverage as appropriate for this change. [ Full content available at: https://github.com/apache/cordova-plugin-network-information/pull/74 ] This message was relayed via gitbox.apache.org for [email protected]
