在机器人的WebView的HTML文件输入(Android 4.4系统,奇巧) [英] HTML file input in android webview (android 4.4, kitkat)

查看:209
本文介绍了在机器人的WebView的HTML文件输入(Android 4.4系统,奇巧)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用的是<输入类型=文件> 在Android的WebView。 我得到它的工作多亏了这个线程: 文件上传中的WebView

I was using the <input type="file"> on the android webview. I got it working thanks to this thread: File Upload in WebView

但接受的答案(或任何其他)不再与Android 4.4奇巧的WebView工作。

But the accepted answer (or any other) no longer works with android 4.4 kitkat webview.

任何人知道如何解决它?

Anybody knows how to fix it?

它不与目标18任工作。

It doesn't work with target 18 either.

我一直在寻找一些Android 4.4系统源$ C ​​$ c和似乎WebChromeClient并没有改变,但我认为 setWebChromeClient 不再对奇巧的作品web视图,或者至少不是 openFileChooser 的功能。

I've looking some android 4.4 source code and it seems that the WebChromeClient hasn't changed, but I think the setWebChromeClient no longer works on the kitkat webview, or at least not the openFileChooser function.

推荐答案

更​​新2: 还有一个更简单的插件使用的PhoneGap /科尔多瓦用

Update 2: There is a simpler plugin to use with phonegap/cordova

https://github.com/MaginSoft/MFileChooser

更新: 与Cesidio DiBenedetto插件示例项目

Update: Sample project with Cesidio DiBenedetto plugin

https://github.com/jcesarmobile/FileBrowserAndroidTest

我开了一个问题在Android开源项目,得到的答案是:

I opened an issue on the android open source project and the answer was:

状态:WorkingAsIntended

Status: WorkingAsIntended

不幸的是,openFileChooser不是公共的API。我们正在对Android的未来版本的一个公共API。

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

对于那些使用的PhoneGap /科尔多瓦,这种解决方法张贴在bug跟踪系统:

For those using phonegap/cordova, this workaround was posted on the bug tracker:

Cesidio DiBenedetto添加了注释 - 28 /三月/ 14 01:27

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

嘿,我已经遇到了这个问题,也是让我写了一个   科尔多瓦文件选择器插件,以一个创可贴暂时。   基本上,在机器人4.4(奇巧),中所提到previous注释,   不打开文件对话框。然而onclick事件仍   解雇了,所以你可以调用文件选择器插件   打开一个文件对话框,在选择,你可以设置一个变量,   包含完整的文件路径。在这一点上,你可以使用   文件传输插件上传到服务器,并挂接到   onprogress事件来显示进度。这个插件主要配置   对于Android 4.4,所以我会建议继续使用原生   文件对话框的早期版本的Andr​​oid系统。可能存在的问题   与插件,因为我还没有完全测试了所有可能的方案上   许多设备,但我已经在Nexus的5安装了它,它工作得很好。

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

没有测试,因为我建立了自己的解决方法

Not tested it because I built my own workaround

注释形成铬开发

我们将在接下来的一个主要增加了公共API来WebViewClient   发布来处理文件的请求。

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

看来他们认为这是一个错误,现在,他们要修复它。

It seems they consider it as a bug now and they are going to fix it

这篇关于在机器人的WebView的HTML文件输入(Android 4.4系统,奇巧)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆