Android - Download and install apk file in Webview

I am trying to make a simple webview for my mobile site. There is a link to the .apk application on this website, and I need to determine when the user clicks on this link. After clicking on the file, it will be downloaded to the SD card, and then form the user for installation, if you want ..

I have read many solutions, but have not yet received a working solution.

Now everything is fine at the stage of detecting the .apk file, but it looks like the open browser by default for these download links in the second, then it turns off, and I don’t know how to automatically install the installation after downloading.

My code that I used.

+7
source share
1 answer

Usually the built-in web view does not have all the features that a regular browser has. Therefore, as soon as you catch the click on apk, you need to do one of the following

Once the download is complete, you can try and start the installation through Intent (most likely Intent.ACTION_VIEW) or install directly through PackageManager . See here programmatically install / uninstall APK (PackageManager vs Intents)

+1
source

All Articles