what are the most common situations ERROR_HTTP_DATA_ERROR can be fired by download manager?
Without seeing any code it's guess work. From the docs:
If an HTTP error occurred, this will hold the HTTP status code as defined in RFC 2616.
This will give you a standard http error from which you can find a 6.1.1 Status Code and Reason Phrase. If you are having millions of downloads, and these are from a limited array of sites, this could be a problem that is beyond your app, as the website's servers may not be coping with the traffic.
and what about network disconnection in the middle of the download?
Internet connectivity issues could cause;
"408" ; Section 10.4.9: Request Time-out
does it also triggers the ERROR_HTTP_DATA_ERROR error after failing all the download's manager retry attempts?
Possibly. For it to throw this type of error, it needs to be a problem with the app communicating with and/or attempting to and/or finishing the download at the website.
is there any way to get from DownloadManager more information about the exact http error?
Beyond using try and catches and logging the errors in the relevant methods where your app uses the DownloadManager
, and then testing and waiting for the logcat when you get this error, the other option would be to remote use a library or third party tool to get remote error logging and crash reports of your deployed app.
There are many third party services and libraries that offer this, I am using one of the reputable open source libraries as an example.
As for online error and crash logging, ACRA is open source and provides this feature. This used to use Google products to store reports freely, but as usage has increased, Google has withdrawn this support, however there are features offered by ACRA and other providers, or you can manage your own reporting, but this may incur cost.
Implementing this is within the app code is relatively straight forward, by creating a class that hooks into your app by extending the application class and launches with the application.
import org.acra.*;
import org.acra.annotation.*;
@ReportsCrashes(
formUri = "http://www.backendofyourchoice.com/reportpath"
)
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// The following line triggers the initialization of ACRA
ACRA.init(this);
}
}
You'll also need to set up the back end reporting, and there are details provided on how to do this, as the options become increased. More detail can be found here, BasicSetup.
This blog by The Cheese Factory gives a detailed view of set up and other options for online error reporting How to setup ACRA, an Android Application Crash Tracking system, on your own host
Application Crash Reports on Android
This will mean an update to your app, but you're going to have to do this anyway from the sounds of it.