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
1 changed files with 1 additions and 3 deletions

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);