Răsfoiți Sursa

Clarify receivers

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 7 ani în urmă
părinte
comite
8dfdf92118

+ 4 - 2
src/main/java/com/owncloud/android/utils/ReceiversHelper.java

@@ -41,7 +41,7 @@ public class ReceiversHelper {
         BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
             @Override
             public void onReceive(Context context, Intent intent) {
-                if (!Device.getNetworkType(context).equals(JobRequest.NetworkType.ANY)) {
+                if (Device.getNetworkType(context).equals(JobRequest.NetworkType.UNMETERED)) {
                     FilesSyncHelper.restartJobsIfNeeded();
                 }
             }
@@ -60,7 +60,9 @@ public class ReceiversHelper {
         BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
             @Override
             public void onReceive(Context context, Intent intent) {
-                FilesSyncHelper.restartJobsIfNeeded();
+                if (intent.getAction().equals(Intent.ACTION_POWER_CONNECTED)) {
+                    FilesSyncHelper.restartJobsIfNeeded();
+                }
             }
         };