download File
Saves file using DownloadManager to users /sdcard/directory
Parameters
an int flag specified in DownloadManager.Request outlining the notification visibility. If enabled, the download manager posts notifications about downloads through the system NotificationManager. By default, a notification is shown only when the download is in progress. It can take the following values: VISIBILITY_HIDDEN, VISIBILITY_VISIBLE, VISIBILITY_VISIBLE_NOTIFY_COMPLETED. If set to VISIBILITY_HIDDEN, this requires the permission Manifest.permission.DOWNLOAD_WITHOUT_NOTIFICATION
one of the Environment
DIRECTORY_*constants. Not all directories are available without a permission to write to external storage. Available dirs are: Environment.DIRECTORY_DOWNLOADS, Environment.DIRECTORY_PICTURES, Environment.DIRECTORY_MOVIES, among others
is called if there was an exception. Possible exceptions are: - ActivityNotFoundException - SecurityException - when permission to write to storage was not granted - IllegalStateException - when provided parameters are invalid (i.e. download directory can't be created)