I have a pretty simple question but somehow not able to find a solution on stackoverflow.
I am able to start the downloading of file from WebView
and also able to listen to Broadcast
after download completes. Here is the relevant code
aWebView.setDownloadListener(new DownloadListener() {
public void onDownloadStart(String url, String userAgent,
String contentDisposition, String mimetype,
long contentLength) {
// Intent i = new Intent(Intent.ACTION_VIEW);
// i.setData(Uri.parse(url));
// startActivity(i);
final String fileName = URLUtil.guessFileName(url,contentDisposition,mimetype);
Request request = new Request(
Uri.parse(url));
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName);
DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
dm.enqueue(request);
}
});
Now what I need to know is, any way we can popup the app Install/Cancel
dialog programmatically for that particular downloaded app ?