Download link not working in android browser app -


recently created simple android browser app website. working fine when click on download link not start downloading. .apk file stored inside server.

downloading working fine in other browsers chrome, android browser , others.

here main-activity code.

{     setcontentview(r.layout.activity_main);     webview ourbrow = (webview) findviewbyid(r.id.webviewapkapps);     ourbrow.setwebviewclient(new ourviewclient());     ourbrow.loadurl("http://websitename .com");     ourbrow.getsettings().setjavascriptenabled(true); } 

adding downloadlistener you!

 {         setcontentview(r.layout.activity_main);         webview ourbrow = (webview) findviewbyid(r.id.webviewapkapps);         ourbrow.setwebviewclient(new ourviewclient());         ourbrow.loadurl("http://websitename .com");         ourbrow.getsettings().setjavascriptenabled(true);       ourbrow.setdownloadlistener(new downloadlistener() {                 public void ondownloadstart(string url, string useragent,                                 string contentdisposition, string mimetype,                                 long contentlength) {                                                uri uri = uri.parse(url);                intent intent = new intent(intent.action_view,uri);                         startactivity(intent);                 }     } 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -