Monday, April 16, 2012

Android : Mime type of .APK and hosting in GoDaddy

Recently we (a group of developers in my current company) developed a small Android app which gives real time updates of a Cricket tournament currently going on in the company .I am not a big fan of cricket even I am not participating in the tournament. But to utilize a chance to learn Android and develop a seasoned app I jumped into this :-) .We were little new to Android deployment scenarios and after developing the first version we came to face the big problem in deployment. We need to get an account in google play market which has some fees in dollars !!! . For a developer in US who draws pay checks in dollar this may not matter .But as we are getting salary in INR, a small confusion started. Company is ready to pay but it may take some time .So decided to host in my personal hosting space which is purchased from godaddy.com .

Things were easy in terms of copying the apk vie FTP. But when we tested from Android mobile it showed an error. Not able to recognize the file because there is no mime type defined for .APK files in the server. It took 30mins in Godaddy interface to realize they don't have support for adding mine type. But soon we remembered the advantage of IIS 7.0 .It allows us to add mime type via the web config.

The mime type of Android application file extension ".APK "is "application/vnd.android.package-archive" .So it was a simpe task of adding the below config entry into the System.WebServer section.

  <system.webServer>
    <staticContent>
      <remove fileExtension=".apk" />
      <mimeMap fileExtension=".apk"
               mimeType="application/vnd.android.package-archive" />
    </staticContent>
     <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

Yes.Now the app is ready from my hosting space.The mobile almost deals the app like how we install from the market. Do we really need the google play market ?Its true that it has a broad reach.

No comments: