apache / cordova-plugin-network-information

Apache Cordova Network Information Plugin
https://cordova.apache.org/
Apache License 2.0
464 stars 321 forks source link

Non-existent proxy resulting in no internet connection is reported as "wifi" #86

Closed guylando closed 5 years ago

guylando commented 5 years ago

In android connect device to wifi and then configure a proxy to the wifi connection such that the proxy ip address is random non-existent. The plugin will report in navigator.connection.type the value "wifi" and will not detect that there is no internet connection. So checking internet connectivity using the plugin is unreliable.

purplecabbage commented 5 years ago

This plugin does not call a network endpoint to verify that the connection is actually connected, it only reports that there is a connection there. If you want to be sure that the connection is usable, you will have to attempt to load something over it.

guylando commented 5 years ago

@purplecabbage would be nice if this plugin would provide this enhancement built in by integrating optionally with something like: ios: https://github.com/tonymillion/Reachability https://github.com/ashleymills/Reachability.swift android: https://stackoverflow.com/questions/8919083/checking-host-reachability-availability-in-android

purplecabbage commented 5 years ago

Thanks for the links @guylando This 'feature' is not worth risking apple rejections, imho. If you make a network call to your server and it fails, assume it is NOT reachable, if it succeeds, assume it IS reachable ... Network based apps should do their best to provide features and remain interactive regardless of network capabilities.

guylando commented 5 years ago

Well it can be used to display "offline" banner like in facebook/google