I have a drupal-based website where people can log in and see private discussion forums. This is where I want to have my beta testers for my Android application download the beta .apk files. I tested this thoroughly on my Android 1.6 based myTouch 3G, and was able to log in, and download files attached to forum posts without problems.
Now comes the interesting part: my testers on Droids and Nexus Ones (Android 2.0.1 and 2.1) were complaining that their downloads are failing. Since I don't have an 2.0 phone, I tried it out in a 2.0 emulator, and lo-and-behold, it didn't work. The download shows the indeterminate progress for a second or two, then shows "Download unsuccessful".
Based on what I see in the logs, it is apparent that the server is returning a 404 for the download request from 2.0 browsers. I can download to my desktop and 1.6 phone no problem. The only reason I can think of that the server would return a 404 for a request is that for some reason the credentials or cookies aren't being passed by the download process. Logcat shows: http error 404 for download x
Some background: I added the mime type to my .htaccess like this: AddType application/vnd.android.package-archive apk
I checked the server logs and see the following for failed downloads: xx.xx.xx.224 - - [28/Jan/2010:20:39:00 -0500] "GET /system/files/grandmajong-beta090.apk HTTP/1.1" 404 - "http://trickybits.com/forums/beta-testing/grandma-jong/latest-version-090-b1" "Mozilla/5.0 (Linux; U; Android 1.6; en-us; sdk Build/Donut) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1"
This sounds like it's related to a long standing problem I've experienced when trying to serve APK's from my own web server. This is not the MIME problem, its not file permissions and there's no path tomfoolery going on. It's as far as I can tell a bug in the Android browser. What I find is with Apache, if I add a .htaccess file which restricts the file/directory, i.e. you'd want it to prompt for a username/password when downloading from a browser, it fails with the error you describe. Remove the .htaccess and all is well. Not good when you've a public website you want to stick your secured test APK's on. Your site is drupal - I'd check for any restriction like this in effect, or indeed if it's not the restriction itself but the presence of the .htaccess file since the exact cause isn't clear.
By the way, an elegant solution to this is to use dropbox. You get your users to install it on their handsets, and when you drop the APK to it, not only are they all notified immediately, but they can then just click the link in their status bar and the app installs, i.e. no MIME or server work needed at all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With