WebView Android OnDownloadStart not trigger

I'm trying to make a download with tag " download /> with WebView, What I need to do to work?

This is my code:
[Activity(Label = "Test, MainLauncher = true)]
public class MainActivity : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);

        // Set our view from the "main" layout resource
        SetContentView(Resource.Layout.Main);

        WebView view = FindViewById<WebView>(Resource.Id.wbWeb);
        view.Settings.JavaScriptEnabled = true;
        view.SetDownloadListener(new DownloadListener());
        view.SetWebViewClient(new NWebViewClient());
        view.LoadUrl("<custom site>");
    }
}

public class DownloadListener : Java.Lang.Object, IDownloadListener
{
    public void OnDownloadStart(string url, string userAgent, string contentDisposition, string mimetype, long contentLength)
    {
        Console.WriteLine("Download");
    }
}

public class NWebViewClient : WebViewClient
{
    public override bool ShouldOverrideUrlLoading(WebView view, string url)
    {
        return base.ShouldOverrideUrlLoading(view, url);
    }
}
Sign In or Register to comment.