Is there a way to automatically trigger the installation process of a just downloaded apk ?
Currently after I download the package , nothing happens unless I click the package ,in which case the packege installer is launched !
The tomcat server from where I download the package has in the web.xml file the following :
<mime-map开发者_如何学Goping>
<extension>apk</extension>
<mime-type>application/vnd.android.package-archive</mime-type>
</mime-mapping>
That is exactly as it should be. Your app can trigger download of an apk but to install it the user must be shown the permissions it requests and explicitly agree. You absolutely cannot 'automatically trigger the installation process'. Even if you are updating an already-installed app.
OS-level permissions are required to call the PackageManager APIs that actually install APK files. These are not available to developers or 3rd party apps.
Since the Android Marketplace is part of the OS and has OS-level permissions, it can prompt the user for permission to download and install an app once before the download begins, and continue the rest of installation without user input.
3rd party apps cannot do this. By design, the only method available for developers/apps to install APK files is to launch the PackageInstaller activity, which will always require an extra verification step from the user before the install happens.
精彩评论