Cannot download & install app APK from own webpage

Solution 1

Why can't I simply upload an APK and have a URL point to it for a download?

You can. Plenty of people do it. There are entire Web sites dedicated to doing it, albeit usually with pirated content.

Why am I getting a 404

Because the URL you are entering into the browser is not the URL where the file is at on the server. This is the cause of approximately 100% of 404 errors, across the Internet, regardless of circumstance.

what can I do to avoid it?

Use the proper URL. Also, be sure to set the server's MIME type configuration map to serve up your file as application/vnd.android.package-archive.

Solution 2

This is what i did in my asp.net application

My Application hosted under Window server 2008r2 having IIS 7

Step 1: In .aspx page add hyperlink set navigateurl as file path

 <asp:HyperLink ID="lnkdwnload" runat="server" NavigateUrl="~/Application_Android/MyAndroidAppAame.apk">Download MyApp</asp:HyperLink>

Step 2: Web.config add mimeMap element under staticContent

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

</system.webServer>

Solution 3

in case you are using .net core,
 public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
...
var provider = new FileExtensionContentTypeProvider();
            // Add new mappings`enter code here`
            provider.Mappings[".apk"] = "application/octet-stream";
            app.UseStaticFiles(new StaticFileOptions()
            {
                ContentTypeProvider = provider
            });
}

Solution 4

Upload a web.config file in the directory where you keep the apk file

The content of the web.config should be :

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".apk" mimeType="application/vnd.android.package-archive" />
</staticContent>
</system.webServer>
</configuration>

Now you can download the apk file..

Solution 5

Thanks it is working

This is what i did in my asp.net application

My Application hosted under Window server 2008r2 having IIS 7

Step 1: In .aspx page add hyperlink set navigateurl as file path

<asp:HyperLink ID="lnkdwnload" runat="server" NavigateUrl="~/Application_Android/MyAndroidAppAame.apk">Download MyApp</asp:HyperLink>

Step 2: Web.config add mimeMap element under staticContent on same path

<system.webServer>
    <staticContent>
      <mimeMap fileExtension=".apk" mimeType="application/vnd.android.package-archive"/>
    </staticContent>
Share:
Admin
Author by

Admin

Updated on July 05, 2022

Comments

  • Admin
    Admin about 1 month

Related