import com.owncloud.android.datamodel.FileDataStorageManager;\r
import com.owncloud.android.datamodel.OCFile;\r
import com.owncloud.android.files.services.FileDownloader;\r
+import com.owncloud.android.files.services.FileObserverService;\r
import com.owncloud.android.utils.OwnCloudVersion;\r
\r
import android.accounts.Account;\r
getStorageManager().getFileByPath(file.getRemotePath()).keepInSync() &&\r
file.getModificationTimestamp() > getStorageManager().getFileByPath(file.getRemotePath())\r
.getModificationTimestamp()) {\r
- Intent intent = new Intent(this.getContext(), FileDownloader.class);\r
+ // first disable observer so we won't get file upload right after download\r
+ Log.d(TAG, "Disabling observation of remote file" + file.getRemotePath());\r
+ Intent intent = new Intent(getContext(), FileObserverService.class);\r
+ intent.putExtra(FileObserverService.KEY_FILE_CMD, FileObserverService.CMD_ADD_DOWNLOADING_FILE);\r
+ intent.putExtra(FileObserverService.KEY_CMD_ARG, file.getRemotePath());\r
+ getContext().startService(intent);\r
+ intent = new Intent(this.getContext(), FileDownloader.class);\r
intent.putExtra(FileDownloader.EXTRA_ACCOUNT, getAccount());\r
intent.putExtra(FileDownloader.EXTRA_FILE, file);\r
file.setKeepInSync(true);\r