2017-09-24 13 views
0

以下のコードを使用していますが、ファイルのダウンロード先はわかりません。指定されたパスに格納されているファイルはありません。コードにはどのような修正が必要ですか?コードは最初にフォルダを作成しています。DownloadManagerの宛先パスを設定する

String path = Environment.getExternalStorageDirectory().getPath() + "/Myapp/Videos"; 
     System.out.println(path); 
     File folder = new File(path); 
     if (folder.canExecute()) { 
      System.out.println("Video Folder Found"); 

     } else { 
      folder.mkdirs(); 
     } 

     DownloadManager.Request request = new DownloadManager.Request(uri); 
     request.setDescription("Selected Video is being downloaded"); 
     request.allowScanningByMediaScanner(); 
     request.setTitle("Downloading Video"); 
     request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); 
     request.setDestinationInExternalFilesDir(mContext, null, title + ".mp4"); 
     DownloadManager manager = (DownloadManager) mContext.getSystemService(Context.DOWNLOAD_SERVICE); 
     manager.enqueue(request); 

     return null; 

答えて

2

単に使用

request.setDestinationInExternalPublicDir("/Path", "test.mp4"); 
関連する問題