Android examples for android.app:DownloadManager
Download Apk With Progress with DownloadManager
//package com.java2s; import android.app.DownloadManager; import android.content.Context; import android.net.Uri; public class Main { public static String MINETYPE_APPLCATION = "application/vnd.android.package-archive"; public static long DownloadApkWithProgress(Context context, String url) { DownloadManager downloadManager = (DownloadManager) context .getSystemService(Context.DOWNLOAD_SERVICE); DownloadManager.Request request = new DownloadManager.Request( Uri.parse(url));/*from www .j a va 2s. c o m*/ request.setDestinationInExternalPublicDir("/headline", "update.apk"); request.setTitle("Updating" + context.getPackageName()); request.setMimeType(MINETYPE_APPLCATION); long downloadId = downloadManager.enqueue(request); return downloadId; } }