Code example for DownloadManager.Request

Methods: setDestinationInExternalPublicDir

0
	public void downloadToExternalPublicFiles(Uri uri, String path) {
		if(isDownloading(uri)) {
			return; 
		} 
		 
		Request request = new Request(uri);
		request.setDestinationInExternalPublicDir(null, path);
		downloadManager.enqueue(request);
		 
		context.registerReceiver(this, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
	} 
 
	public boolean isDownloading(final Uri uri) {
		switch(getDownloadStatus(uri)) {
			case DownloadManager.STATUS_PAUSED:
			case DownloadManager.STATUS_PENDING:
			case DownloadManager.STATUS_RUNNING:
				return true; 
			case DownloadManager.STATUS_FAILED:
			case DownloadManager.STATUS_SUCCESSFUL:
			default: