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.
Application Xamarin Forms Android. The application has a WebView element that displays different sites. On these sites, it is possible to download files. But the file cannot be downloaded via WebView.
Android WebView is a pre-installed system component from Google that allows Android apps to display web content. Updated on. Nov 14, 2022. Tools.
Typically the embedded webview wont have all the features that the normal browser has. Therefore, once you catch the click on the apk then you have to do one of the following
HttpUrlConnection
Once the download has completed, you can try and kick off the install via an Intent (most likely Intent.ACTION_VIEW) or install directly via PackageManager
.
See here install / uninstall APKs programmatically (PackageManager vs Intents)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With