Click or drag to resize

PackageInstallerSession Class

To install two applications using a session do the following steps:
  1. Obtain an instance of PackageInstaller with [!:Com.Datalogic.Device.App.PackageInstaller.PackageInstaller(Context)]. -
  2. Obtain an instance of IPackageInstallerListener that will be used to handle the result of the commands invoked on the session. -
  3. Create a PackageInstallerSession calling CreateSession(IPackageInstallerListener). The CreateSession(IPackageInstallerListener) method takes as parameters the instance of IPackageInstallerListener created at the previous step. -
  4. Start a session calling OpenSession. -
  5. Call [!:Com.Datalogic.Device.App.PackageInstallerSession.install(java.lang.String,%20boolean)] to install the first application. -
  6. Call [!:Com.Datalogic.Device.App.PackageInstallerSession.install(java.lang.String,%20boolean)] to install the second application. -
  7. Close and commit the session calling CloseSession. -
  8. The method onResult of the listener will be called when the execution of all the commands of the transaction are completed, either with success or failure. It contains the result of each command. -
Inheritance Hierarchy
Object
  Com.Datalogic.Device.AppPackageInstallerSession

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 class PackageInstallerSession : Object, 
	IServiceConnection, IJavaObject, IDisposable, IJavaPeerable

The PackageInstallerSession type exposes the following members.

Constructors
  NameDescription
Public methodPackageInstallerSession
Initializes a new instance of the PackageInstallerSession class
Top
Properties
  NameDescription
Public propertyJniPeerMembers
To be added.
Top
Methods
  NameDescription
Public methodCloseSession
Call this method to execute the commands queued in the session.
Public methodInstall(IListString, Boolean)
Call this method to install the applications contained within the .apk files specified by apks.
Public methodInstall(String, Boolean)
Call this method to install the application contained within the .apk file specified by apk.
Public methodOnServiceConnected
To be added.
Public methodOnServiceDisconnected
To be added.
Public methodOpenSession
Call this method to start a session.
Public methodUninstall
Call this method to unistall an application installed on the device.
Public methodUpgrade
Call this method to upgrade an application installed on the device.
Top
Remarks
PackageInstallerSession gives developers the ability to group the execution of a sequence of install, uninstall and upgrade commands. Once the session is created, the commands install, uninstall, upgrade must be called inside a transaction. A transaction is opened calling OpenSession and closed and commited calling CloseSession.

To install two applications using a session do the following steps:

  1. Obtain an instance of PackageInstaller with [!:Com.Datalogic.Device.App.PackageInstaller.PackageInstaller(Context)]. -
  2. Obtain an instance of IPackageInstallerListener that will be used to handle the result of the commands invoked on the session. -
  3. Create a PackageInstallerSession calling CreateSession(IPackageInstallerListener). The CreateSession(IPackageInstallerListener) method takes as parameters the instance of IPackageInstallerListener created at the previous step. -
  4. Start a session calling OpenSession. -
  5. Call [!:Com.Datalogic.Device.App.PackageInstallerSession.install(java.lang.String,%20boolean)] to install the first application. -
  6. Call [!:Com.Datalogic.Device.App.PackageInstallerSession.install(java.lang.String,%20boolean)] to install the second application. -
  7. Close and commit the session calling CloseSession. -
  8. The method onResult of the listener will be called when the execution of all the commands of the transaction are completed, either with success or failure. It contains the result of each command. -

[Android Documentation]

See Also