4

We use DownloadManager to download mbtiles from server. I've downloaded 2 files successfully, but now every time I start download download animation in status bar appears, then quickly disappears. When I open downloads app I see my download with status queued.

Sometimes it tries to download it again but it become "queued" again.

I have no other active downloads on my queue

Here is method I use to start download

 private void download(String lowResUrl) {
    DownloadManager downloadManager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
    if (downloadManager != null) {
        Uri url = Uri.parse(lowResUrl);
        DownloadManager.Request request = new DownloadManager.Request(url);
        request.addRequestHeader("Authorization", PreferencesUtils.getAccessToken(this));

        File file = getExternalFilesDir(null);
        file = new File(file.getPath() + "/maps");
        if (!file.exists()) {
            file.mkdir();
        }
        request.setDestinationInExternalFilesDir(getApplicationContext(), null, "maps/" + url.getLastPathSegment());
        request.setTitle("Loading map");
        request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
        downloadManager.enqueue(request);
    }

}

What should I do to start download successfully?

earsonheart
  • 1,042
  • 2
  • 12
  • 25

0 Answers0