Skip to content Skip to sidebar Skip to footer

W/downloadmanager: Aborting Request For Download 17: Failed To Create Target File /storage/emulated/0/ringtone/fav_ringtone.mp3

I am trying to download my mp3 file and want to save it to internal storage at a specific location. But every time my download is failing. Logcat error message 01-01 08:36:09.295

Solution 1:

change your code to this

    public void Save_mp3_internal_Storage(Uri uri, Context context){

        Delete_mp3_internal_Storage(context);

        DownloadManager manager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);

        DownloadManager.Request request = new DownloadManager.Request(uri);
                request.setDestinationInExternalFilesDir(context,Environment.DIRECTORY_ALARMS,"Fav_Ringtone.mp3")
                .setTitle("Ringtone Downloading")
                .setNotificationVisibility(1);
                 manager.enqueue(request);
    }

    public void Delete_mp3_internal_Storage(Context context){
       File file = new File(context.getExternalFilesDir(Environment.DIRECTORY_ALARMS),"Fav_Ringtone.mp3");
       if (file.exists()){file.delete();}
    }

Post a Comment for "W/downloadmanager: Aborting Request For Download 17: Failed To Create Target File /storage/emulated/0/ringtone/fav_ringtone.mp3"