One user sent me the following error:
java.lang.IllegalArgumentException: Unknown URL content://downloads/my_downloads
at android.content.ContentResolver.insert(ContentResolver.java:860)
at android.app.DownloadManager.enqueue(DownloadManager.java:904)
at
even if i use the following code:
ApplicationInfo ai = null;//Check if download manager is enabled
try {
ai = this.getPackageManager().getApplicationInfo("com.android.providers.downloads",0);
} catch (NameNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
appStatus = ai.enabled;
When user tries to download
if(appStatus=false){
// Download manager not available.....
}
else {
//filename=String
String fileName=URLUtil.guessFileName(url,contentDisposition,mimetype);
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName);
request.setDescription(fileName);
manager.enqueue(request);
}
What i am doing wrong?