[英]android - where does WebView download its files to?
I am implementing a simple download system in the embedded webview, by intercepting the click using shouldOverrideUrlLoading and then call: 我正在嵌入式webview中实现一个简单的下载系统,方法是使用shouldOverrideUrlLoading拦截点击,然后调用:
Intent intent = new Intent(Intent.ACTION_VIEW ,Uri.parse(url));
startActivity(intent);
This opens the native browser, shows an indicator that the file is being downloaded, and once it's completed I can pull down the notification list to view the file. 这将打开本机浏览器,并显示一个指示文件正在下载的指示符,完成后,我可以拉下通知列表以查看文件。 I have several questions though:
我有几个问题:
Ultimately what I'm trying to achieve is that, once the file is downloaded, the next time the user clicks to the link, it will open up the local downloaded file, instead of trying to download it again. 最终,我要实现的目标是,一旦下载了文件,下次用户单击链接时,它将打开本地下载的文件,而不是尝试再次下载。
Looking at the emulator through the DDMS perspective in Eclipse it looks like the files are downloaded to either yourAppsNamespace/cache/webviewCache or actually into the yourAppsNamespace/databases/ . 通过Eclipse中的DDMS透视图查看模拟器,看起来文件已下载到yourAppsNamespace / cache / webviewCache或实际上已下载到yourAppsNamespace / databases /中。 So the file should be a permanent download.
因此,该文件应为永久下载。 As to knowing when the download is complete i am not sure
至于知道什么时候下载完成我不确定
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.