0

Hi I am loading an external web page to my WebView. That web page has an upload pdf and upload image buttons. But When I click on these buttons it doesn't open the gallery or documents.

This is my code

        _webView = FindViewById<WebView>(Resource.Id.webview);


        _webView.Settings.JavaScriptEnabled = true;
        _webView.Settings.DomStorageEnabled = true;
        _webView.Settings.DatabaseEnabled = true;
        _webView.Settings.AllowFileAccess = true;
        _webView.Settings.AllowContentAccess = true;
        _webView.SetWebViewClient(new HelloWebViewClient());
        _webView.SetWebChromeClient(new CustomChromeClient());

public class CustomChromeClient : WebChromeClient
{
    public override void OnPermissionRequest(PermissionRequest request)
    {
        request.Grant(request.GetResources());
    }
}

How can I resolve this? Please help me. Thanks!

Randi
  • 639
  • 2
  • 6
  • 23
  • ,Please confirm whether you have associated the Button OnClick in the Webview with the method in C#, here is the help link:https://stackoverflow.com/questions/54067402/how-to-run-a-java-script-function-and-get-return-in-android/54069075#54069075 – Cherry Bu - MSFT Aug 02 '19 at 02:57

1 Answers1

0

You need to explicitly ask the android system to launch an intent to choose a file. The following page should tell you how to request all sorts of media types. Mainly I think you want file chooser.

https://developer.android.com/guide/topics/providers/document-provider#java

devchimp
  • 754
  • 6
  • 18