I\'m trying to build web project using android, from webview. I have a input field of type file to let user upload files to server,
The answer by Riad points into the right direction, but that single callback is not enough to implement.
There are, in total, four hidden API methods that you have to implement. Their usage depends on the Android version. These methods are:
public void openFileChooser(ValueCallback uploadMsg)
public void openFileChooser(ValueCallback uploadMsg, String acceptType)
public void openFileChooser(ValueCallback uploadMsg, String acceptType, String capture)
public boolean onShowFileChooser(WebView webView, ValueCallback filePathCallback, WebChromeClient.FileChooserParams fileChooserParams)
You can use the following library which does all these things for you:
https://github.com/delight-im/Android-AdvancedWebView
Alternatively, you may take a look at the source code to see how it's done:
https://github.com/delight-im/Android-AdvancedWebView/blob/master/Source/src/im/delight/android/webview/AdvancedWebView.java