I want to develop an application for the android platform that can download some files from my server.
How can i use android\'s download manager like it is used in the A
Use this class for downloading any file using download manager
public class DLManager {
@SuppressLint("NewApi")
public static void useDownloadManager(String url, String name, Context c) {
DownloadManager dm = (DownloadManager) c
.getSystemService(Context.DOWNLOAD_SERVICE);
DownloadManager.Request dlrequest = new DownloadManager.Request(
Uri.parse(url));
dlrequest
.setAllowedNetworkTypes(
DownloadManager.Request.NETWORK_WIFI
| DownloadManager.Request.NETWORK_MOBILE)
.setTitle("Title")
.setDescription("Downloading in Progress..")
.setDestinationInExternalPublicDir("Directory_name", name + ".jpg")
.allowScanningByMediaScanner();
dm.enqueue(dlrequest);
}
}