1

I want to download a file in my app. I Use this code for Download and its work.

    manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);   
String url = json_string_4_all[0];
                    DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
                    id = manager.enqueue(request);
                    request.setDescription("درصد دانلود ");
                    request.setTitle("دانلود کتاب " + json_string_1_all[0]);

                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                        request.allowScanningByMediaScanner();
                        request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
                    }
                 request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, json_string_1_all[0] + ".pdf");manager.enqueue(request);

how can i fine out it seccessfully be download?

Ramin Roshan
  • 526
  • 1
  • 5
  • 10

0 Answers0