mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 12:49:55 +01:00
Merge branch 'add-comment-for-is-connected' into 'master'
Add comment about NetworkInfo#isConnected() See merge request briar/briar!1762
This commit is contained in:
@@ -118,6 +118,11 @@ class AndroidNetworkManager implements NetworkManager, Service {
|
|||||||
try {
|
try {
|
||||||
NetworkInfo net = connectivityManager.getActiveNetworkInfo();
|
NetworkInfo net = connectivityManager.getActiveNetworkInfo();
|
||||||
boolean connected = net != null && net.isConnected();
|
boolean connected = net != null && net.isConnected();
|
||||||
|
// Research into Android's behavior to check network connectivity
|
||||||
|
// (https://code.briarproject.org/briar/public-mesh-research/-/issues/19)
|
||||||
|
// has shown that NetworkInfo#isConnected() returns true if the device
|
||||||
|
// is connected to any Wifi, independent of whether any specific IP
|
||||||
|
// address can be reached using it or any domain names can be resolved.
|
||||||
boolean wifi = false, ipv6Only = false;
|
boolean wifi = false, ipv6Only = false;
|
||||||
if (connected) {
|
if (connected) {
|
||||||
wifi = net.getType() == TYPE_WIFI;
|
wifi = net.getType() == TYPE_WIFI;
|
||||||
|
|||||||
Reference in New Issue
Block a user