I’m writing a website which give a APK download automatically when someone accesses the link “http://www.sample-link.com/download/downloadApp
This is my code on PHP site.
$fileName = "./uploads/MyAPK.apk";
header('Content-type: application/download');
header('Content-Disposition: attachment; fileName="' . basename($fileName) . '"');
header('Content-Transfer-Encoding: binary');
readfile($fileName);
When I visit that link on PC, it works. When I do it on Android devices, the download can’t be done. It’s stuck in the download queue with error “Unable to download. Content not supported”. I tried to restart the device but it doesn’t work. How to fix?
Use
application/vnd.android.package-archiveas content type for apks.Reference: wikipedia