Click or drag to resize

PackageInstallerSessionInstall Method (IListString, Boolean)

Call this method to install the applications contained within the .apk files specified by apks.

Namespace:  Com.Datalogic.Device.App
Assembly:  datalogic-xamarin-sdk (in datalogic-xamarin-sdk.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public virtual int Install(
	IList<string> apks,
	bool atomic
)

Parameters

apks
Type: System.Collections.GenericIListString
- ArrayList list of the full path of the .apk files to be installed.
atomic
Type: SystemBoolean
- boolean true if "apks" lists the multiple split APKs of the application to be installed.

Return Value

Type: Int32
intSuccess in case of success, otherwise a possible error code, matching one of the PackageInstallerException error constants.
Exceptions
ExceptionCondition
PackageInstallerException - in case of error, when exceptions are enabled through the ErrorManager singleton.
Remarks

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 must be called after having called the OpenSession

.

The method is queued internally and executed when the CloseSession

is called.

The result of the command is received through the listener method [M:Com.Datalogic.Device.App.IPackageInstallerListener.OnResult(System.Collections.Generic.IList`1)]

.


Example:

public int install(ArrayList pkgs, boolean atomic)


PackageInstaller packageInstaller = new PackageInstaller(context);

PackageInstallerListener listener = new PackageInstallerListener{public void onResult(List results) {...}};

PackageInstallerSession session = packageInstaller.createSession(listener);

session.openSession();

ArrayList apks = new ArrayList();

apks.add("/dir1/dir11/dir116/pkg1.apk");

apks.add("/dir1/dir11/dir116/pkg2.apk");

session.install(apks, false);

session.closeSession();

[Android Documentation]

See Also