1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-26 14:21:16 +00:00

Ignore active network info for wifi state (fixes #235).

This commit is contained in:
Felix Ableitner 2015-03-14 12:05:54 +01:00
parent e43ca2adfc
commit c90f35e395

View file

@ -22,9 +22,7 @@ public class NetworkReceiver extends BroadcastReceiver {
ConnectivityManager cm =
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo wifiInfo = cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
NetworkInfo activeNetworkInfo = cm.getActiveNetworkInfo();
boolean isWifiConnected = (wifiInfo != null && wifiInfo.isConnected()) ||
activeNetworkInfo == null;
boolean isWifiConnected = (wifiInfo != null && wifiInfo.isConnected());
Log.v(TAG, "Received wifi " + (isWifiConnected ? "connected" : "disconnected") + " event");
Intent i = new Intent(context, SyncthingService.class);
i.putExtra(DeviceStateHolder.EXTRA_HAS_WIFI, isWifiConnected);