Automatic apk download


I was trying to download the android apk file located at Hockey App share point but could only download a part of file not the complete file. Below is the code attached.
If possible please have a look and help me out in the issue.

FirefoxProfile profile = new FirefoxProfile();
// profile.setPreference(“”, “Downloads”);
profile.setPreference(“browser.helperApps.neverAsk.saveToDisk”, “application/”);// MIME type for apk file
WebDriver driver = new FirefoxDriver(profile);

Also, I tried using Content Type header(“text/html; charset=utf-8”) value shown in the Network monitor of Firefox. But that didn’t work as well.
Any other solution apart from this is also appreciated.