title: How can i download a file from minio server URL
body: <p>This is the <a href="https://stag-minio.shoppre.com/test/2022/1/0f9ee055-f321-4b69-9e0e-3672bf2ee3eb.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;X-Amz-Credential=VLJVI0W8O91GZ7UTP9M7%2F20220317%2Fus-east-1%2Fs3%2Faws4_request&amp;X-Amz-Date=20220317T111707Z&amp;X-Amz-Expires=86400&amp;X-Amz-SignedHeaders=host&amp;X-Amz-Signature=5d3f8a095ac5cae67a182e6c1c64ce0095f97432abe266cc2d37e24472534d55" rel="nofollow noreferrer">URL</a> I am getting from response which is minion encoded</p>
  <p>Here I am trying to decode the URL which I got from the API response which is encoded by minio</p>
  <pre><code>        LoadingDialog.showLoadingDialog(getActivity(), &quot;&quot;);
          Call&lt;DownloadInvoiceModelResponse&gt; call = TransactionRetrofitClient.getInstance3().getAppApi().downloadInvoice(&quot;Bearer &quot; + sharedPrefManager.getBearerToken(), transactionId);
          call.enqueue(new Callback&lt;DownloadInvoiceModelResponse&gt;() {
              @Override
              public void onResponse(Call&lt;DownloadInvoiceModelResponse&gt; call, Response&lt;DownloadInvoiceModelResponse&gt; response) {
                  if (response.code() == 200) {
                      if (response.body().getObject()!=null &amp;&amp; !response.body().getObject().equals(&quot;&quot;)){
                          url = response.body().getObject();
  `Trying to decode the URL i am getting from response`
                          try {
                              result = URLDecoder.decode(url, &quot;UTF-8&quot;);
                              Log.d(&quot;Decoded URL&quot;, result);
                          } catch (UnsupportedEncodingException e) {
                              // not going to happen - value came from JDK's own StandardCharsets
                          }
  
                          tvDownloadInvoice.setVisibility(View.VISIBLE);
                      }
  
                      LoadingDialog.cancelLoading();
  
                  } else if (response.code() == 401) {
                      callRefreshTokenApi(&quot;download&quot;);
                  } else {
                      LoadingDialog.cancelLoading();
                      Toast.makeText(getActivity(), response.message(), Toast.LENGTH_SHORT).show();
                  }
              }
  
              @Override
              public void onFailure(Call&lt;DownloadInvoiceModelResponse&gt; call, Throwable t) {
                  LoadingDialog.cancelLoading();
                  Toast.makeText(getActivity(), t.toString(), Toast.LENGTH_SHORT).show();
              }
          });
  
  </code></pre>
  <p>Here I am trying to download a file from decoded URL which is coming from the API response</p>
  <pre><code>private void downloadFile() {
  
      getActivity().registerReceiver(broadcastReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
  
      DownloadManager.Request request = new DownloadManager.Request(Uri.parse(result));
      String title = URLUtil.guessFileName(result, null, null);
      request.setTitle(title);
      request.setDescription(&quot;Downloading file please wait....&quot;);
      request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
      request.allowScanningByMediaScanner();
      request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, title);
  
      downloadManager = (DownloadManager) `enter code here`getActivity().getSystemService(Context.DOWNLOAD_SERVICE);
      downloadManager.enqueue(request);
  
      Toast.makeText(getActivity(), &quot;Downloading Start&quot;, Toast.LENGTH_SHORT).show();
  }
  </code></pre>