PackageInstallerInstall Method (IListString, Boolean, IPackageInstallerListener) |
Namespace: Com.Datalogic.Device.App
public virtual int Install( IList<string> apks, bool atomic, IPackageInstallerListener listener )
Exception | Condition |
---|---|
PackageInstallerException | - in case of error, when exceptions are enabled through the ErrorManager singleton. |
Call this method to install the applications contained within the .apk files specified by apks.
It allows also the installation of an app distributed as multiple split APKs. Only in this
case set atomic = true.
The method is executed alone, not grouped together with other methods as can be done using a PackageInstallerSession
. The result of the command is received through the listener method [M:Com.Datalogic.Device.App.IPackageInstallerListener.OnResult(System.Collections.Generic.IList`1)]
.
Do not suspend the UIThread while waiting for the result of the method otherwise an application’s deadlock can occur.
Example:
public int install(ArrayList pkgs, boolean atomic)
PackageInstaller packageInstaller = new PackageInstaller(context);
PackageInstallerListener listener = new PackageInstallerListener{public void onResult(List results) {...}};
ArrayList apks = new ArrayList();
apks.add("/dir1/dir11/dir116/pkg1.apk");
apks.add("/dir1/dir11/dir116/pkg2.apk");
packageInstaller.install(apks, false);