Code example for DownloadManager.Request

Methods: setDescription, setDestinationInExternalFilesDir, setTitle

0
 
				if (info != null) {
					if (info.isConnected()) {
						String pathOfFile = "http://developer.android.com/shareables/icon_templates-v4.0.zip";
						Uri uri = Uri.parse(pathOfFile);
						DownloadManager.Request request = new Request(uri);
						request.setTitle("developer.android.com");
						request.setDescription("Icon templates");
						request.setDestinationInExternalFilesDir(
								DownloadManagerDemoActivity.this,
								Environment.DIRECTORY_DOWNLOADS, "icon.zip");
 
						// request.setAllowedNetworkTypes(Request.NETWORK_WIFI); 
						reference = manager.enqueue(request);
 
					} else { 
						AlertDialog.Builder builder = new AlertDialog.Builder(
								DownloadManagerDemoActivity.this);
						builder.setTitle("Error");
						builder.setMessage("Internet is not connected");
Stop searching for code, let great code find you!  Add Codota to your java IDE