Java DownloadManager上的请求始终处于队列中
我们使用DownloadManager从服务器下载mbtiles。我已经成功下载了2个文件,但现在每次我开始下载时,状态栏中的动画都会出现,然后很快消失。当我打开下载应用程序时,我看到我的下载状态已排队 有时它试图再次下载它,但它再次“排队” 我的队列中没有其他活动下载 下面是我开始下载的方法Java DownloadManager上的请求始终处于队列中,java,android,download-manager,Java,Android,Download Manager,我们使用DownloadManager从服务器下载mbtiles。我已经成功下载了2个文件,但现在每次我开始下载时,状态栏中的动画都会出现,然后很快消失。当我打开下载应用程序时,我看到我的下载状态已排队 有时它试图再次下载它,但它再次“排队” 我的队列中没有其他活动下载 下面是我开始下载的方法 private void download(String lowResUrl) { DownloadManager downloadManager = (DownloadManager) get
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);
}
}
我应该怎样做才能成功开始下载