diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/BatteryReceiver.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/BatteryReceiver.java index e26f8f20..27cea9e2 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/BatteryReceiver.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/BatteryReceiver.java @@ -3,15 +3,19 @@ package com.nutomic.syncthingandroid.syncthing; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import android.util.Log; /** * Receives battery plug/unplug intents and sends the charging state to {@link SyncthingService}. */ public class BatteryReceiver extends BroadcastReceiver { + private static final String TAG = "BatteryReceiver"; + @Override public void onReceive(Context context, Intent intent) { boolean isCharging = Intent.ACTION_POWER_CONNECTED.equals(intent.getAction()); + Log.v(TAG, "Received charger " + (isCharging ? "connected" : "disconnected") + " event"); Intent i = new Intent(context, SyncthingService.class); i.putExtra(DeviceStateHolder.EXTRA_IS_CHARGING, isCharging); context.startService(i); diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/NetworkReceiver.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/NetworkReceiver.java index 3de4e374..9f52bd7b 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/NetworkReceiver.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/NetworkReceiver.java @@ -5,12 +5,15 @@ import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; +import android.util.Log; /** * Receives network connection change intents and sends the wifi state to {@link SyncthingService}. */ public class NetworkReceiver extends BroadcastReceiver { + private static final String TAG = "NetworkReceiver"; + @Override public void onReceive(Context context, Intent intent) { ConnectivityManager cm = @@ -19,6 +22,7 @@ public class NetworkReceiver extends BroadcastReceiver { NetworkInfo activeNetworkInfo = cm.getActiveNetworkInfo(); boolean isWifiConnected = (wifiInfo != null && wifiInfo.isConnected()) || activeNetworkInfo == null; + Log.v(TAG, "Received wifi " + (isWifiConnected ? "connected" : "disconnected") + " event"); Intent i = new Intent(context, SyncthingService.class); i.putExtra(DeviceStateHolder.EXTRA_HAS_WIFI, isWifiConnected); context.startService(i);