7

I am trying to make a simple webview for my mobile website. There are app link .apk on that website and I need to detect when user click on those link. After clicking file will be downloaded to SD card, then form user to install if want to..

I have read many solutions but did not get working solution yet.

Now all good at step to detect the .apk file, but it seem open default browser for those download link in second then go off, and I don't know how to auto-form install after downloaded.

My Code that I used.

4

1 回答 1

1

通常,嵌入式 webview 不会具有普通浏览器具有的所有功能。因此,一旦您点击了 apk,您就必须执行以下操作之一

  1. 通过 Android DownloadManager 下载文件(此处为http://www.vogella.com/blog/2011/06/14/android-downloadmanager-example/示例)
  2. 通过自己下载文件HttpUrlConnection

下载完成后,您可以尝试通过 Intent(很可能是 Intent.ACTION_VIEW)开始安装,或者直接通过PackageManager. 请参阅此处以编程方式安装/卸载 APK(PackageManager 与 Intents)

于 2013-04-15T05:51:00.200 回答