To install an application do the following steps:
- Obtain an instance of PackageInstaller with [!:Com.Datalogic.Device.App.PackageInstaller.PackageInstaller(Context)].
-
- Obtain an instance of IPackageInstallerListener that will be used to handle the
result of the command. This object must be passed as parameter to
the install method.
-
- To perform the install session call [!:Com.Datalogic.Device.App.PackageInstaller.install(java.lang.String,%20boolean,%20com.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.
-
Inheritance Hierarchy Object
Com.Datalogic.Device.AppPackageInstaller
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 PackageInstaller : Object
Public Class PackageInstaller
Inherits Object
The PackageInstaller type exposes the following members.
Constructors Properties Methods Remarks 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:
- Obtain an instance of PackageInstaller with [!:Com.Datalogic.Device.App.PackageInstaller.PackageInstaller(Context)].
-
- Obtain an instance of IPackageInstallerListener that will be used to handle the
result of the command. This object must be passed as parameter to
the install method.
-
- To perform the install session call [!:Com.Datalogic.Device.App.PackageInstaller.install(java.lang.String,%20boolean,%20com.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:
- Obtain an instance of PackageInstaller with [!:Com.Datalogic.Device.App.PackageInstaller.PackageInstaller(Context)].
-
- Obtain an instance of IPackageInstallerListener that will be used to handle the
result of the command. This object must be passed as parameter to the uninstall method.
-
- To perform the uninstall session call [!:Com.Datalogic.Device.App.PackageInstaller.uninstall(java.lang.String,%20com.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:
- Obtain an instance of PackageInstaller with [!:Com.Datalogic.Device.App.PackageInstaller.PackageInstaller(Context)].
-
- Obtain an instance of IPackageInstallerListener that will be used to handle the
result of the command. This object must be passed as parameter to the upgrade method.
-
- To perform the upgrade session call [!:Com.Datalogic.Device.App.PackageInstaller.upgrade(java.lang.String,%20com.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:
- Obtain an instance of PackageInstaller with [!:Com.Datalogic.Device.App.PackageInstaller.PackageInstaller(Context)].
-
- Obtain an instance of IPackageInstallerListener that will be used to handle the
result of the commands. This object must be passed as parameter to the createSession method.
-
- Obtain an instance of PackageInstallerSession with CreateSession(IPackageInstallerListener).
-
- Open a transaction on the session calling OpenSession.
-
- Call the methods [!:Com.Datalogic.Device.App.PackageInstallerSession.install(java.lang.String,%20boolean)], Uninstall(String), Upgrade(String) that
suite you.
-
- Close and commit the transaction on the session calling CloseSession.
-
- 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:
- Obtain an instance of PackageInstaller with [!:Com.Datalogic.Device.App.PackageInstaller.PackageInstaller(Context)].
-
- Call SelfUpgrade(String) passing as parameter the name of the package to be used to upgrade the current application.
-
[Android Documentation]
See Also