download a file using a downloadable link into webView android -


i want download file using direct downloadable link webview. links "https://drive.google.com/uc?id=0bw6vr2lnxb3iufjrtk5ozdljata&export=download". if open link using default browser browser automatically download file. dont want open default web browser want use webview. tried code:

webview = (webview) findviewbyid(r.id.webview1);         webview.getsettings().setjavascriptenabled(true);         webview.loadurl(url);         webview.setdownloadlistener(new downloadlistener() {              @override             public void ondownloadstart(string url, string useragent,                     string contentdisposition, string mimetype,                     long contentlength) {                 // todo auto-generated method stub                 toast.maketext(getapplicationcontext(), "yes", toast.length_short).show();                 request request = new request(                         uri.parse(url));                 request.allowscanningbymediascanner();                 request.setnotificationvisibility(downloadmanager.request.visibility_hidden);                 request.setdestinationinexternalpublicdir(environment.directory_downloads, "download");                  downloadmanager dm = (downloadmanager) getsystemservice(download_service);                 dm.enqueue(request);                 }         }); 

i put toast inside setdownloadlistener toast doesn't appear means setdownloadlistener doesn't work here? can tell me how solve issue? have stack problem long time cant able solve.


Comments

Popular posts from this blog

java - Null response to php query in android, even though php works properly -

node.js - Using Node without global install -

php - CakePHP HttpSockets send array of paramms -