gpt4 book ai didi

android - android webview中的HTML文件输入(android 4.4,kitkat)

转载 作者:IT王子 更新时间:2023-10-28 23:54:42 26 4
gpt4 key购买 nike

我使用的是 <input type="file">在android webview上。由于这个线程,我得到了它的工作: File Upload in WebView

但接受的答案(或任何其他)不再适用于 android 4.4 kitkat webview。

有人知道怎么解决吗?

它也不适用于目标 18。

我查看了一些 android 4.4 源代码,似乎 WebChromeClient 没有改变,但我认为 setWebChromeClient不再适用于 kitkat webview,或者至少不适用于 openFileChooser功能。

最佳答案

更新 2:有一个更简单的插件可以与 phonegap/cordova 一起使用

https://github.com/MaginSoft/MFileChooser

更新:带有 Cesidio DiBenedetto 插件的示例项目

https://github.com/jcesarmobile/FileBrowserAndroidTest

我开了一个issue在android开源项目上,答案是:

Status: WorkingAsIntended

unfortunately, openFileChooser is not a public API. We are working on a public API in future releases of Android.

对于使用 phonegap/cordova 的用户,此解决方法已发布在错误跟踪器上:

Cesidio DiBenedetto added a comment - 28/Mar/14 01:27

Hey all, I've been experiencing this issue as well so I wrote a Cordova FileChooser plugin to a "band-aid" for the time being. Basically, in Android 4.4(KitKat), as mentioned in previous comments, the file dialog is not opened. However the onclick event is still fired on so you can call the FileChooser plugin to open a file dialog and upon selection, you can set a variable that contains the full path to the file. At this point, you can use the FileTransfer plugin to upload to your server and hook into the onprogress event to show progress. This plugin is mainly configured for Android 4.4 so I would recommend to continue to use the native file dialogs for earlier versions of Android. There might be issues with the plugin as I have not fully tested all possible scenarios on many devices, but I have installed it on a Nexus 5 and it worked fine.

https://github.com/cdibened/filechooser

未对其进行测试,因为我构建了自己的解决方法

来自 Chromium 开发者的评论

We will be a adding a public API to WebViewClient in next major release to handle file requests.

他们现在似乎认为这是一个错误,他们将修复它

关于android - android webview中的HTML文件输入(android 4.4,kitkat),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19882331/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com