title: Ask for permission when clicked on download button
body: <p>I am making an app with webView in Android studio. It contains pictures only so I also have an integrated download button in my app. In android Marshmallow version you have to ask for permission and I have a permission code in onCreate like this:</p>
  
  <pre><code>int check = ActivityCompat.checkSelfPermission(this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE);
      if (check == PackageManager.PERMISSION_GRANTED) {
          //Do something
      } else {
          requestPermissions(new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE},1024);
      }
  </code></pre>
  
  <p>but it pops up when the app starts and I want to pop it up when the user clicks on the download button. </p>
  
  <p>my download button in html looks like this:</p>
  
  <pre><code>&lt;a href="url"&gt;Download&lt;/a&gt;
  </code></pre>
  
  <p>and the download code in app looks like this:</p>
  
  <pre><code> @Override
          public boolean shouldOverrideUrlLoading(WebView view, String url) {
              if (url.endsWith(".jpg")) {
                      Uri source = Uri.parse(url);
                      // Make a new request pointing to the .apk url
                      DownloadManager.Request request = new DownloadManager.Request(source);
                      // appears the same in Notification bar while downloading
                      request.setDescription("Description for the DownloadManager Bar");
                      request.setTitle("PunjabiDharti.jpg");
                      if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB) {
                          request.allowScanningByMediaScanner();
                          request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
                      }
                      // save the file in the "Downloads" folder of SDCARD
                      request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "PunjabiDharti.jpg");
                      // get download service and enqueue file
                      DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
                      manager.enqueue(request);
  </code></pre>
  
  <p>How to pop up the request permission when the user clicks on the download button ?</p>