'Android getContentLength always return -1 when downloading apk file
I'm using the following code for downloading file in my Android project:
URL url = new URL(fileUrl);
URLConnection conection= url.openConnection();
conection.setDoOutput(true);
conection.connect();
int lenghtOfFile = conection.getContentLength();
If fileUrl is apk, lenghtOfFile always return -1.
But if it is image, video type,... lenghtOfFile return is exactly.
Why ?
I'm using eclipse, Android SDK revision 23.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
