2

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-mapping>
        <extension>apk</extension>
        <mime-type>application/vnd.android.package-archive</mime-type>
    </mime-mapping>
rantravee
  • 7,411
  • 9
  • 35
  • 47

2 Answers2

2

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.

Jim Blackler
  • 22,946
  • 12
  • 85
  • 101
  • Yet I wonder how "android market" application achieves this : you select an application , it is downloaded and then automatically installed – rantravee Apr 15 '10 at 10:26
  • Even so , in order for the package installer to start the user has to click the newly downloaded package , isn't there a way to skip this "clicking" part ? – rantravee Apr 15 '10 at 10:31
  • "Yet I wonder how "android market" application achieves this : you select an application , it is downloaded and then automatically installed" ... OK we might be talking at cross-purposes then, because using the Market for me, user input is still required to agree to the installation terms. You would be able to implement something similar to Market, once users have enabled Non-Market APKs in their settings. – Jim Blackler Apr 15 '10 at 10:35
  • Pretty much that's what I desire . But I'm stuck on starting the installation after the download finishes , even if the I already got the user consent on installing the application . I'd like to click the install button , agree on the required permissions , and then have the application installed , using the package installer. – rantravee Apr 15 '10 at 11:19
2

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.

Sam
  • 21
  • 1