I having a problem with this URL url its a 302 url and it redirects to this site when you run in brwoser http://mp3goo.io/ but when you post this on a download manager it shows 10 mb file and i downloaded and worked fine. And i checked with my android code it says -1 content length how to get the file size like download manager image
use this
new Thread(new Runnable() {
@Override
public void run() {
try {
URL myUrl = new URL(url);
URLConnection urlConnection = myUrl.openConnection();
urlConnection.connect();
int file_size = urlConnection.getContentLength();
Log.i("sasa", "file_size = " + file_size);
} catch (IOException e) {
e.printStackTrace();
}
}
}).start();