[英]Html page to download and install apk from browser
I have an app that will be installed by the user from a public webserver (outside android market). 我有一个应用程序将由用户从公共网络服务器(在Android市场之外)安装。
So I hosted the apk in webserver and instructed the users to type the url to download the file and then "open" the downloaded file to install it. 所以我在webserver中托管了apk,并指示用户输入url来下载文件,然后“打开”下载的文件进行安装。
But, almost 100% of users are having difficulties to do those simple tasks (they're are not familiar with technology...). 但是,几乎100%的用户都难以完成这些简单的任务(他们不熟悉技术......)。
So, I decided to make a webpage that will simplify the task. 所以,我决定制作一个简化任务的网页。 The page contains a single big button that will:
该页面包含一个大按钮,该按钮将:
Dowloading file is pretty easy, but now my problem is to open the "Install dialog" from browser! 下载文件非常简单,但现在我的问题是从浏览器打开“安装对话框”!
I'm totally newbie about html/javascript and I don't know how to do it (or even if this is possible). 我完全是关于html / javascript的新手,我不知道该怎么做(或者即使这是可能的)。
Normally, you just link to the .apk
file. 通常,您只需链接到
.apk
文件。 When the user clicks on such a link, the .apk
file is downloaded and the installation is automatically started (with a dialog like 'do you want to install this application'). 当用户单击此类链接时,将下载
.apk
文件并自动启动安装(使用“您是否要安装此应用程序”这样的对话框)。
So, just <a href="yourdomain.com/yourapp.apk">Download and install...</a>
. 因此,只需
<a href="yourdomain.com/yourapp.apk">Download and install...</a>
。
Important! 重要! This only works if your users allow installation from 'Unknown sources' in settings/security.
仅当您的用户允许从设置/安全性中的“未知来源”进行安装时,此方法才有效。
If browser is written not by you, then it doesn't know what to do with downloaded apk file. 如果浏览器不是由您编写的,那么它不知道如何处理下载的apk文件。 Ask user to download something like EasyInstall to install side-loaded apks or place you apk on Google Play.
要求用户下载类似EasyInstall的东西来安装侧载apks或将apk放在Google Play上。 Google Play app on the device knows how to install apk.
设备上的Google Play应用知道如何安装apk。
-- True at the time of writing: Aug. 2012 - 在撰写本文时为真:2012年8月
You need to ensure your webserver that is going to deliver the APK sets the MIME type properly. 您需要确保将要提供APK的Web服务器正确设置MIME类型。 It should be
application/vnd.android.package-archive
for .apk files. 它应该是.apk文件的
application/vnd.android.package-archive
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.