Nothing wrong in your code, seems like your server is responding with HTTP redirect staus code, which is causing DownloadManager to fail to process download.
From Android Docs :-
public static final int ERROR_UNHANDLED_HTTP_CODE
Added in API level 9 Value of COLUMN_REASON when an HTTP code was received that download manager can't handle.
See below code snippet:-
From Android Framework source code DownloadManger.java
case Downloads.Impl.STATUS_UNHANDLED_HTTP_CODE:
case Downloads.Impl.STATUS_UNHANDLED_REDIRECT:
return ERROR_UNHANDLED_HTTP_CODE;
So you need to check your Server logs for this issue, or pass direct file url to download manager which doesn't cause any redirect.
Also please note that you need below two permissions in your Androidmanifest.xml for download to work as expected
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>