0

I'm downloading an mp3 with DownloadManager and when the download is finished, on BroadcastReceiver I try to play it with MediaPlayer.

Why does File.length() for downloaded file return zero ? That prevents me from playing MP3 immediately after the download. After a few seconds the File.length() returns true as value and I can play the MP3!!

DownloadManager.Request request = new DownloadManager.Request(Uri.parse(fileURL));
request.setDestinationUri(Uri.fromFile(myExternalFile));
did = downloadManager.enqueue(request);

All permissions and other codes are correct, I am just not able to play mp3 immediately after the download.

hossein
  • 99
  • 3
  • 11

0 Answers0