Android Tutorial Tip: Distributing your app on iis web server

After hours of research i was able to create a download link for my app on a windows server. here are the instructions for doing so.

under iis create a mime type by right clicking on your server name then click properties. select mime types button and add .apk with the mime type
application/vnd.android.package-archive


Next

create a download.aspx page or whatever you want to call it

add the following to your page

<html>
<asp:HyperLink ID="lnkdwnload" runat="server" NavigateUrl="~/myfile.apk">Download myfile</asp:HyperLink>
</html>

Next in web.config add the following under <system.webserver>
<staticContent>
<mimeMap fileExtension=".apk" mimeType="application/vnd.android.package-archive"/>
</staticContent>

Restart IIS and your users can now download your app

After More Research the user had to click the link then go to the downloads folder to install the application, if you want to use a pretty view, graphic or whatever use the url method above, else it is possible to use the method below after you have set your iis settings

<code>
Sub getNewVersion()
Dim DlApk as intent
Dim uri as string

'This will directly start the download of your file on the iis server
uri = "HTTP PATH TO YOUR APK FILE"
DlApk.Initialize(DlApk.ACTION_VIEW,uri)
StartActivity(DlApk)
'Because the above is browser based it places the file in your downloads folder this cannot be avoided
'The below method opens the downloads folder automatically

'you could add a message box or notification here if required
'most times people do not clear out thier download history its best to let the user know to use the greatest number of your file.apk

'you should disable any services or processes that your current application uses before allowing the user to install the new application

Dim Intent1 As Intent

Intent1.Initialize(Intent1.ACTION_MAIN, "")
Intent1.SetComponent("com.android.providers.downloads.ui/.DownloadsListTab")
StartActivity(Intent1)

'Finally exit application
ExitApplication
End Sub
</code>
 
Last edited:

Rusty

Well-Known Member
Licensed User
Longtime User
Does this mean the .apk will automatically install or does it just download the .apk for the user to have to install manually?
Thanks,
Rusty
 

Rusty

Well-Known Member
Licensed User
Longtime User
I've had this code in my website for almost a year and it does not start the "installation process". It does successfully download my .apk into the SDCARD/Downloads folder.
The user then has to have a file manager and then navigate to the .apk; then touch the .apk to install it; it then asks the users permissions.
Am I misunderstanding or doing something wrong?
Thanks Erel
 

Rusty

Well-Known Member
Licensed User
Longtime User
Thanks Erel, I have tried this with IE, FireFox, Chrome and Safari and none work with the exact settings above. (Download works, but install doesn't unless manually initiated by user)
Regards,
 

Rusty

Well-Known Member
Licensed User
Longtime User
The device. I use the browser; navigate to my website; click the hyperlink defined in the above post and it downloads to my android device's download folder.
I can then touch the .apk within the folder and it will install, but it does not install upon download as indicated in posts above.
Thanks Erel
 

geoffschultz

Member
Licensed User
Longtime User
Where is "web.config" located?

[edit]

The file is located in C:\Windows\System32\inetsrv\config\applicationHost.config

However, a better way to add ".apk" as a mime type is to go into the

control panel/System and Security/Administrative Tools/IIS Server/MIME types

Then add ".apk" as an extension with "application/vnd.android.package-archive" as the MIME type.
 
Last edited:
Top