Click or drag to resize

Com.Datalogic.Device.App Namespace

Classes
Class Description
Public class AppManager
AppManager gives developers the ability to manage installed applications.

Public class AppManagerException
This exception is used for AppManager related errors.
Public class PackageInstaller
PackageInstaller gives developers the ability to install, uninstall and upgrade applications in unattended/silent mode. The install/uninstall/upgrade/selfUpgrade methods are asynchronous. An object that implements PackageInstallerListener must be passed to PackageInstaller to be able to handle the result.
An install/uninstall/upgrade method can be executed alone calling the corresponding method of the PackageInstaller or together with other methods grouped in a PackageInstallerSession. In the former case there will be a result callback for each method, in the latter case there will be only one callback listing the results of each method. The methods grouped in a PackageInstallerSession are executed in best effort.

To install an application do the following steps:

  1. Obtain an instance of PackageInstaller with PackageInstaller(Context).
  2. Obtain an instance of PackageInstallerListener that will be used to handle the result of the command. This object must be passed as parameter to the install method.
  3. To perform the install session call install(java.lang.String, boolean, com.datalogic.device.app.PackageInstallerListener). The method onResult of the listener will be called when the install session has completely finished, either with success or failure.

To uninstall an application do the following steps:

  1. Obtain an instance of PackageInstaller with PackageInstaller(Context).
  2. Obtain an instance of PackageInstallerListener that will be used to handle the result of the command. This object must be passed as parameter to the uninstall method.
  3. To perform the uninstall session call uninstall(java.lang.String, com.datalogic.device.app.PackageInstallerListener). The method onResult of the listener will be called when the uninstall session has completely finished, either with success or failure.

To upgrade an application do the following steps:

  1. Obtain an instance of PackageInstaller with PackageInstaller(Context).
  2. Obtain an instance of PackageInstallerListener that will be used to handle the result of the command. This object must be passed as parameter to the upgrade method.
  3. To perform the upgrade session call upgrade(java.lang.String, com.datalogic.device.app.PackageInstallerListener). The method onResult of the listener will be called when the upgrade session has completely finished, either with success or failure.

To execute more install/uninstall/upgrade methods and be notified of the results when all the methods have completed, do the following steps:

  1. Obtain an instance of PackageInstaller with PackageInstaller(Context).
  2. Obtain an instance of PackageInstallerListener that will be used to handle the result of the commands. This object must be passed as parameter to the createSession method.
  3. Obtain an instance of PackageInstallerSession with createSession(com.datalogic.device.app.PackageInstallerListener).
  4. Open a transaction on the session calling PackageInstallerSession.openSession().
  5. Call the methods PackageInstallerSession.install(java.lang.String, boolean), PackageInstallerSession.uninstall(java.lang.String), PackageInstallerSession.upgrade(java.lang.String) that suite you.
  6. Close and commit the transaction on the session calling PackageInstallerSession.closeSession().
  7. The method onResult of the listener will be called when all the methods listed in the session have completed, either with success or failure.

To upgrade the current application do the following steps:

  1. Obtain an instance of PackageInstaller with PackageInstaller(Context).
  2. Call selfUpgrade(java.lang.String) passing as parameter the name of the package to be used to upgrade the current application.
Public class PackageInstallerEvent
Public class PackageInstallerEventArgs
Public class PackageInstallerException
This exception is used for installer related errors.
Public class PackageInstallerResult
PackageInstallerResult is the base element of the List passed by PackageInstallerListener.onResult(java.util.List<com.datalogic.device.app.PackageInstallerResult>) to retrieve the result of operations of install/uninstall/upgrade.
Public class PackageInstallerSession
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 PackageInstaller(Context).
  2. Obtain an instance of PackageInstallerListener that will be used to handle the result of the commands invoked on the session.
  3. Create a PackageInstallerSession calling PackageInstaller.createSession(com.datalogic.device.app.PackageInstallerListener). The PackageInstaller.createSession(com.datalogic.device.app.PackageInstallerListener) method takes as parameters the instance of PackageInstallerListener created at the previous step.
  4. Start a session calling openSession().
  5. Call install(java.lang.String, boolean) to install the first application.
  6. Call install(java.lang.String, boolean) 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.
Interfaces