Reason for PlaceHolder to download fail with Download Manager in Android
I am using Download Manager to download file types (.mov, .pdf, .png). When I call the download manager, the download does not provide an explanation for the site owner. What does seat owner mean and how can I fix this problem? Please, help!
My code looks like this:
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(downloadUrlFile))
.setDestinationInExternalFilesDir(context,
(Environment.DIRECTORY_DOWNLOADS), downloadFileName).setNotificationVisibility(visibility);
mEnqueue = downloadManager.enqueue(request);
mDownloadReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Log.d(TAG, "DOWNLOAD_STATUS"+intent.getAction());
String action = intent.getAction();
if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) {
Query query = new Query();
query.setFilterById(mEnqueue);
Cursor c = downloadManager.query(query);
if (c.moveToFirst()) {
int columnIndex = c .getColumnIndex(DownloadManager.COLUMN_STATUS);
Log.d("getColumnIndex()", "Reason: " + c
.getColumnIndex(DownloadManager.COLUMN_STATUS)+DownloadManager.STATUS_SUCCESSFUL);
if (DownloadManager.STATUS_SUCCESSFUL == c.getInt(columnIndex)) {
Log.d(TAG, "DOWNLOAD_STATUS_SUCCESSFUL");
} else if (DownloadManager.STATUS_FAILED == c.getInt(columnIndex)) {
Log.d("handleData()", "Reason: " + c.getString(c.getColumnIndex(DownloadManager.COLUMN_REASON)));
Log.d(TAG, "DOWNLOAD_STATUS_FAILED");
}
}
}
}
};
+3
source to share