DownloadManager downloadManager = (DownloadManager)mainActivity.getSystemService(mainActivity.DOWNLOAD_SERVICE); downloadManager.addCompletedDownload(file.getName(), file.getName(), true, "application/json", file.getAbsolutePath(),file.length(),true);
DownloadManager downloadManager = (DownloadManager)mainActivity.getSystemService(mainActivity.DOWNLOAD_SERVICE); downloadManager.addCompletedDownload(file.getName(), file.getName(), true, "application/json", file.getAbsolutePath(),file.length(),true);
/** * @see android.app.DownloadManager#addCompletedDownload(String, String, boolean, String, * String, long, boolean) */ protected long addCompletedDownload(String fileName, String description, String mimeType, String path, long length, String originalUrl, String referer) { DownloadManager manager = (DownloadManager) mContext.getSystemService(Context.DOWNLOAD_SERVICE); return manager.addCompletedDownload(fileName, description, true, mimeType, path, length, false); }
public static void downloadLocalFile(Context context, File src, String name) throws IOException { File downloadFolder = Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_DOWNLOADS); File dst = new File(downloadFolder, name); FileUtils.copyFile(src, dst); String mimeType = StringHelper.getMimeType(dst); DownloadManager downloadManager = (DownloadManager) context.getSystemService(Activity.DOWNLOAD_SERVICE); downloadManager.addCompletedDownload( dst.getName(), dst.getName(), true, mimeType, dst.getPath(), dst.length(), true); }
dm.addCompletedDownload(file.getName(), "Kandroid download", false, mime, file.getPath(), file.length(), true);
Environment.DIRECTORY_DOWNLOADS), fileName); if (fromFile.renameTo(toFile)) { manager.addCompletedDownload( fileName, mDownloadInfo.getDescription(), false, mDownloadInfo.getMimeType(), toFile.getPath(),
return Long.toString(mDm.addCompletedDownload( file.getName(), file.getName(), false, mimeType, file.getAbsolutePath(), 0L, false));
private void publishFile(DocumentFile fileDocument, long size) { if (!ShareSettingsFragment.isCustomDestinationEnabled(device.getContext())) { Log.i("SharePlugin", "Adding to downloads"); DownloadManager manager = (DownloadManager) device.getContext().getSystemService(Context.DOWNLOAD_SERVICE); manager.addCompletedDownload(fileDocument.getUri().getLastPathSegment(), device.getName(), true, fileDocument.getType(), fileDocument.getUri().getPath(), size, false); } else { //Make sure it is added to the Android Gallery anyway Log.i("SharePlugin", "Adding to gallery"); MediaStoreHelper.indexFile(device.getContext(), fileDocument.getUri()); } }
try { DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE); dm.addCompletedDownload(filename, "xDrip+ update version " + newversion, false, "application/vnd.android.package-archive", getDownloadFolder() + "/" + filename, FILE_SIZE, true); } catch (Exception e) { Log.e(TAG, "Download manager error: " + e);
try { DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE); dm.addCompletedDownload(filename, "xDrip+ update version " + newversion, false, "application/vnd.android.package-archive", getDownloadFolder() + "/" + filename, FILE_SIZE, true); } catch (Exception e) { Log.e(TAG, "Download manager error: " + e);
dm.addCompletedDownload(file.getName(), getString(R.string.download_manager_name), false, mime, file.getPath(), file.length(), true); Thread.sleep(500); mNotificationManager.cancel(554);