mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
Merge pull request #2373 from nextcloud/check-wifi-on-offline-sync
Check if we’re on unmetered wifi
This commit is contained in:
commit
1f64297dc4
1 changed files with 5 additions and 1 deletions
|
@ -29,6 +29,8 @@ import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import com.evernote.android.job.Job;
|
import com.evernote.android.job.Job;
|
||||||
import com.evernote.android.job.JobManager;
|
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.MainApp;
|
||||||
import com.owncloud.android.authentication.AccountUtils;
|
import com.owncloud.android.authentication.AccountUtils;
|
||||||
import com.owncloud.android.datamodel.FileDataStorageManager;
|
import com.owncloud.android.datamodel.FileDataStorageManager;
|
||||||
|
@ -55,7 +57,9 @@ public class OfflineSyncJob extends Job {
|
||||||
final Context context = MainApp.getAppContext();
|
final Context context = MainApp.getAppContext();
|
||||||
|
|
||||||
PowerManager.WakeLock wakeLock = null;
|
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<Job> jobs = JobManager.instance().getAllJobsForTag(TAG);
|
Set<Job> jobs = JobManager.instance().getAllJobsForTag(TAG);
|
||||||
for (Job job : jobs) {
|
for (Job job : jobs) {
|
||||||
if (!job.isFinished() && !job.equals(this)) {
|
if (!job.isFinished() && !job.equals(this)) {
|
||||||
|
|
Loading…
Reference in a new issue