newDownload.addDatatransferProgressListener(this);
newDownload.addDatatransferProgressListener((FileDownloaderBinder) mBinder);
requestedDownloads.add(downloadKey);
+
+ // Store file on db with state 'downloading'
+ FileDataStorageManager storageManager = new FileDataStorageManager(account, getContentResolver());
+ file.setDownloading(true);
+ storageManager.saveFile(file);
+
sendBroadcastNewDownload(newDownload);
} catch (IllegalArgumentException e) {
file.setStoragePath(mCurrentDownload.getSavePath());
file.setFileLength((new File(mCurrentDownload.getSavePath()).length()));
file.setRemoteId(mCurrentDownload.getFile().getRemoteId());
+ file.setDownloading(false);
mStorageManager.saveFile(file);
mStorageManager.triggerMediaScan(file.getStoragePath());
}