diff --git a/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobManagerImpl.kt b/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobManagerImpl.kt index 21473ae9d9..bd503302a8 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobManagerImpl.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobManagerImpl.kt @@ -720,6 +720,11 @@ internal class BackgroundJobManagerImpl( val tag = getSyncFolderTag(folderId) val filePaths = files.map { it.decryptedRemotePath } + val constraints = Constraints.Builder() + .setRequiredNetworkType(NetworkType.CONNECTED) + .setRequiresStorageNotLow(true) + .build() + val data = Data.Builder() .putStringArray(SyncWorker.FILE_PATHS, filePaths.toTypedArray()) .build() @@ -727,6 +732,7 @@ internal class BackgroundJobManagerImpl( val request = oneTimeRequestBuilder(SyncWorker::class, JOB_SYNC_FOLDER) .addTag(tag) .setInputData(data) + .setConstraints(constraints) .build() workManager.enqueueUniqueWork(JOB_SYNC_FOLDER, ExistingWorkPolicy.REPLACE, request)