PackageManager Property

Applies to TestComplete 14.40, last modified on April 22, 2021

Description

Returns the PackageManager object providing access to Android application packages installed on the device.

Declaration

AndroidDeviceObj.PackageManager

Read-Only Property A PackageManager object.
AndroidDeviceObj An expression, variable or parameter that specifies a reference to an AndroidDevice object

Applies To

The property is applied to the following object:

Property Value

The PackageManager object that provides access to packages installed on the device.

Example

The following code obtains the number of packages installed on the VirtualBox device using the PackageManager object and then posts this number to the test log:

JavaScript, JScript

function Test()
{
  var DeviceObj = Mobile.Device("MyDevice");
  var PackManagerObj = DeviceObj.PackageManager;
  var Num = PackManagerObj.InstalledPackageCount;
  Log.Message("The number of installed packages is: " + aqConvert.VarToStr(Num));
}

Python

def Test():
  DeviceObj = Mobile.Device("MyDevice")
  PackManagerObj = DeviceObj.PackageManager
  Num = PackManagerObj.InstalledPackageCount
  Log.Message("The number of installed packages is: " + aqConvert.VarToStr(Num))

VBScript

Sub Test
  Set DeviceObj = Mobile.Device("MyDevice")
  Set PackManagerObj = DeviceObj.PackageManager
  Num = PackManagerObj.InstalledPackageCount
  Call Log.Message("The number of installed packages is: " + aqConvert.VarToStr(Num))
End Sub

DelphiScript

function Test;
var DeviceObj, PackManagerObj, Num: OleVariant;
begin
  DeviceObj := Mobile.Device('MyDevice');
  PackManagerObj := DeviceObj.PackageManager;
  Num := PackManagerObj.InstalledPackageCount;
  Log.Message('The number of installed packages is: ' + aqConvert.VarToStr(Num));
end;

C++Script, C#Script

function Test()
{
  var DeviceObj = Mobile["Device"]("MyDevice");
  var PackManagerObj = DeviceObj["PackageManager"];
  var Num = PackManagerObj["InstalledPackageCount"];
  Log["Message"]("The number of installed packages is: " + aqConvert["VarToStr"](Num));
}

See Also

PackageManager Object
AndroidDevice Object

Highlight search results