I have webview. I set it a download manager. But when I open url with .apk, it sometines downloading apk 2 times automatically and always opening complete action with dialog box. 

My WebView code:

```
mWebView.setWebViewClient(new WebViewClient() {

            @Override
            public void onReceivedError(WebView view, int errorCode,
                                        String description, String failingUrl) {
                Toast.makeText(MainActivity.this, 
                               "Bağlantı Hatası", Toast.LENGTH_LONG).show();
            }

            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                boolean shouldOverride = false;
                mWebView.setDownloadListener(new DownloadListener() {
                        public void onDownloadStart(String url, String userAgent,
                                                    String contentDisposition, String mimetype,
                                                    long contentLength) {
                            Intent i = new Intent(Intent.ACTION_VIEW);
                            i.setData(Uri.parse(url));
                            startActivity(i);
                        }
                    });
                if (url.endsWith(".apk")) {
                    shouldOverride = true;
                    Uri source = Uri.parse(url);

                    DownloadManager.Request request = new DownloadManager.Request(source);
                    File destinationFile = new File (destinationDir, source.getLastPathSegment());

                    File to = new File(destinationDir, "BL" + ".apk");
                    request.setDestinationUri(Uri.fromFile(destinationFile));
                    manager.enqueue(request);
                    destinationFile.renameTo(to);
                }
                view.getSettings().setJavaScriptEnabled(true);
                view.loadUrl(url);
                return true;
            }

        });

    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.loadUrl(sbllink);
    if (!destinationDir.exists()) {
        destinationDir.mkdir();
    }

```