From 857a31172c09c0c145e2afcbc7d8fa544cb7b5c0 Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Mon, 19 Mar 2018 14:42:13 +0100 Subject: [PATCH] =?UTF-8?q?Check=20if=20we=E2=80=99re=20on=20unmetered=20w?= =?UTF-8?q?ifi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mario Danic --- src/main/java/com/owncloud/android/jobs/OfflineSyncJob.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/owncloud/android/jobs/OfflineSyncJob.java b/src/main/java/com/owncloud/android/jobs/OfflineSyncJob.java index c9129ef7c2..fa69b02959 100644 --- a/src/main/java/com/owncloud/android/jobs/OfflineSyncJob.java +++ b/src/main/java/com/owncloud/android/jobs/OfflineSyncJob.java @@ -29,6 +29,8 @@ import android.support.annotation.NonNull; import com.evernote.android.job.Job; import com.evernote.android.job.JobManager; +import com.evernote.android.job.JobRequest; +import com.evernote.android.job.util.Device; import com.owncloud.android.MainApp; import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.datamodel.FileDataStorageManager; @@ -55,7 +57,9 @@ public class OfflineSyncJob extends Job { final Context context = MainApp.getAppContext(); PowerManager.WakeLock wakeLock = null; - if (!PowerUtils.isPowerSaveMode(context) && !ConnectivityUtils.isInternetWalled(context)) { + if (!PowerUtils.isPowerSaveMode(context) && + Device.getNetworkType(context).equals(JobRequest.NetworkType.UNMETERED) && + !ConnectivityUtils.isInternetWalled(context)) { Set jobs = JobManager.instance().getAllJobsForTag(TAG); for (Job job : jobs) { if (!job.isFinished() && !job.equals(this)) {