From Android 4.1 to Android 4.3, you could subclass WebChromeClient
on Android and implement the following (hidden, thus no @Override
) method:
If you're looking for a clean solution to do this this without using tricky Javascript codes and detectors. I'd recommend using a Webview alternative.
Crosswalk
I'd recommend this. It'll work similar to the official webview. It's open source and made by the same people behind ChromeView. They've got a great setup guide: https://crosswalk-project.org/documentation/embedding_crosswalk.html
Check it out: https://crosswalk-project.org/
Chromium Webview
Also inspired by ChromeView. They claim to have integrated the same API's as the official webview for easy migration. But they indicate that the Webview still might be a bit unstable.
Check it out: https://github.com/mogoweb/chromium_webview
GeckoView
Made by Mozilla. Here's a demo project that uses it. Mozilla warns: "This is not a drop webview replacement and very unstable", but it has file upload
Check it out: https://wiki.mozilla.org/Mobile/GeckoView
If you're open on using Javascript (perhaps usefull for others) try:
Kitkat Webview
It uses javascript to enable file upload in KitKat webview do this. The demo allows you to upload an image, but you should be able to edit it to fit your needs.
Check it out: https://github.com/henrychuangtw/Kitkat-WebView