从网页安装 apk

发布于 2024-08-22 09:34:34 字数 64 浏览 7 评论 0原文

我正在寻找一个示例网页(html 代码),其中包含一个链接,通过单击该链接可以直接在我的手机上安装 apk 文件。

I'm looking for a sample web page (html code) with a link that will install an apk file directly on my phone by clicking on the link.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

残疾 2024-08-29 09:34:34

只需链接到 HTML 中的 apk 文件即可。简单得不能再简单了。

<a href="path to my .apk file">link</a>

您必须在手机上启用“安装未知来源的应用程序”。

Just link to the apk file in the HTML. It couldn't be any simpler.

<a href="path to my .apk file">link</a>

You will have to have "install apps from unknown sources" enabled on your phone.

肤浅与狂妄 2024-08-29 09:34:34

如果您使用的是 ASP.NET,那么您需要在 web.config 文件中插入以下内容:

<configuration>
  ...

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

  ...
</configuration>

除此之外(正如其他人所说),您只需要一个普通链接:

<a href="myAndroidApp.apk">Click here</a>

并告诉您的用户启用安全性->设置中的未知来源选项。

If you're using ASP.NET, then you'll need to insert the following in your web.config file:

<configuration>
  ...

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

  ...
</configuration>

Apart from that (as others have said), you just need a normal link:

<a href="myAndroidApp.apk">Click here</a>

and tell your users to enable the Security -> Unknown sources option in Settings.

腻橙味 2024-08-29 09:34:34

对 IIS Web 服务器的额外帮助:在我将 apk mime 类型添加到 IIS Web 服务器后,mbaird 的示例对我来说非常有用。我只是将一个 html 文件与该链接放在一起,但在尝试提取没有 .apk mime 条目的 test.apk 文件时出现 404 错误。正如 Commonsware 所说,请确保允许 mime 类型中的 .apk 文件 - 这在 IIS Web 服务器上肯定仍然是必要的。您可以从 IIS 管理器执行此操作,选择服务器,找到“Mime 类型”,然后添加一个条目。 在 IIS 中为 apk 文件添加 Mime 条目的示例

Extra help for IIS webservers: mbaird's example worked great for me after I added the apk mime type to my IIS webserver. I just put an html file up with that link, but got a 404 error when trying to pull up my test.apk file without the .apk mime entry. As Commonsware said, make sure to allow .apk files in the mime types - this is for sure still necessary on an IIS webserver. You can do this from IIS Manager, select the server, and find "Mime Types", then add an entry. Example of adding a Mime entry for the apk file in IIS

流殇 2024-08-29 09:34:34

在.Net中,这就是我所做的,我创建了一个 .asmx 页面,然后创建了一个指向它的二维码
否则,我不断收到 404 错误,然后在页面加载时出现此错误。

protected void Page_Load(object sender, EventArgs e){
    ViewState["PreviousPage"] = Request.UrlReferrer;
    string filepath = Server.MapPath("AcsMainMenu.apk");
    FileInfo droidfile = new FileInfo(filepath);

    if (droidfile.Exists)
    {
        Response.ClearContent();
        Response.AddHeader("Content-Disposition", "attachment; filename=" + droidfile.Name);
        Response.AddHeader("Content-Length", droidfile.Length.ToString());
        Response.ContentType = "application/vnd.android.package-archive";
        Response.TransmitFile(droidfile.FullName);
        Response.Flush();
        Response.End();
        Response.Redirect(ViewState["PreviousPage"].ToString());
    }
}

In .Net this is what I did, I created an .asmx page then a QR code that pointed to it
other wise I kept getting a 404, then this on page load.

protected void Page_Load(object sender, EventArgs e){
    ViewState["PreviousPage"] = Request.UrlReferrer;
    string filepath = Server.MapPath("AcsMainMenu.apk");
    FileInfo droidfile = new FileInfo(filepath);

    if (droidfile.Exists)
    {
        Response.ClearContent();
        Response.AddHeader("Content-Disposition", "attachment; filename=" + droidfile.Name);
        Response.AddHeader("Content-Length", droidfile.Length.ToString());
        Response.ContentType = "application/vnd.android.package-archive";
        Response.TransmitFile(droidfile.FullName);
        Response.Flush();
        Response.End();
        Response.Redirect(ViewState["PreviousPage"].ToString());
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文