Reputation: 1313
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.
Upvotes: 7
Views: 7719
Reputation: 1565
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)
Upvotes: 1