Android DownloadManager.Request - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android DownloadManager.Request class.

This code example shows how to use the following methods: enqueue, setDestinationInExternalPublicDir
 
        // Check whether we have permission to write file to external storage. 
        // We only start download request if we have permission. 
        if (!checkWriteExternalPermission()) return; 
 
        Request request = new Request(Uri.parse(url));
        request.setDestinationInExternalPublicDir(
                Environment.DIRECTORY_DOWNLOADS, fileName);
        getDownloadManager().enqueue(request);
        popupMessages(DOWNLOAD_START_TOAST + fileName);
    } 
 
    private String getFileName(String url, String contentDisposition, String mimetype) {
        String fileName = URLUtil.guessFileName(url, contentDisposition, mimetype);
        int extensionIndex = fileName.lastIndexOf(".");
        String extension = null;
        if ((extensionIndex > 1) && (extensionIndex < fileName.length())) {
            extension = fileName.substring(extensionIndex + 1);
        } 
 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setDescription, setDestinationInExternalPublicDir, setNotificationVisibility, setShowRunningNotification, setTitle
  
        Environment  
            .getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) 
            .mkdirs(); 
  
        Request req = new DownloadManager.Request(uri); 
  
        req.setTitle("Demo"); 
        req.setDescription("android-ndk-r6-linux-x86.tar.bz2"); 
        req.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS,"android-ndk-r6-linux-x86.tar.bz2"); 
        req.setNotificationVisibility(0); 
        req.setShowRunningNotification(true); 
  
        lastDownload = mDownloadManager.enqueue(req);  
    }     
	 
} 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setDescription, setDestinationInExternalPublicDir, setNotificationVisibility, setShowRunningNotification, setTitle
  
        Environment  
            .getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) 
            .mkdirs(); 
  
        Request req = new DownloadManager.Request(uri); 
  
        req.setTitle("Demo"); 
        req.setDescription("android-ndk-r6-linux-x86.tar.bz2"); 
        req.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS,"android-ndk-r6-linux-x86.tar.bz2"); 
        req.setNotificationVisibility(0); 
        req.setShowRunningNotification(true); 
  
        lastDownload = mDownloadManager.enqueue(req);  
    }     
	 
} 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setDescription, setDestinationInExternalPublicDir, setMimeType, setTitle
		// MIME Type을 확장자를 통해 예측한다. 
		String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length()).toLowerCase();
		String mimeType = mtm.getMimeTypeFromExtension(fileExtension);
 
		// Download 디렉토리에 저장하도록 요청을 작성 
		Request request = new DownloadManager.Request(downloadUri);
		request.setTitle(fileName);
		request.setDescription(url);
		request.setMimeType(mimeType);
		request.setDestinationInExternalPublicDir( "/Android/data/com.ssm.luaming/files/.Luaming/" + activity.accessToken + "/" + activity.packageName, activity.updateName);
 
		// 다운로드 매니저에 요청 등록 
		activity.downloadId = downloadManager.enqueue(request);
		 
		// Progress Dialog 
		activity.pd = new LuamingProgressDialog(activity);
		 
		LuamingDownloadTask downTask = new LuamingDownloadTask(activity);
		 
		activity.pd.setAsyncTask(downTask);
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setAllowedNetworkTypes, setDescription, setDestinationInExternalPublicDir, setVisibleInDownloadsUi
				 
				public void onDownloadStart(String url, String userAgent,
						String contentDisposition, String mimetype, long contentLength) {
					DownloadManager downloadManager = (DownloadManager) getActivity().getSystemService(Context.DOWNLOAD_SERVICE);
					Uri uri = Uri.parse(url);  
				    Request request = new Request(uri);  
				    request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_MOBILE|DownloadManager.Request.NETWORK_WIFI);    
				    request.setVisibleInDownloadsUi(true);  
				   // request.setDestinationUri(Uri.parse("/mnt/sdcard/a.doc")); 
				    request.setDescription("电子书下载中");
				    request.setDestinationInExternalPublicDir("ebook",uri.getLastPathSegment());
				    downloadManager.enqueue(request);
				} 
			}); 
		return v;
	} 
 
	public boolean onBack() { 
		if(v!=null&&v.canGoBack()){
			v.goBack();
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android DownloadManager.Request Questions & Answers:

See Code Examples for Android DownloadManager.Request Methods: