PackageManager Object

Applies to TestComplete 14.30, last modified on November 21, 2019

Description

The PackageManager object provides access to mobile application packages. You can use this object to install or remove a package, obtain the number of packages installed on a device and so on.

The object is returned by the PackageManager property of the Device object.

In order for TestComplete to be able to provide access to an Android device, the device should be connected to Android Debug Bridge.

Members

Example

The code below obtains the number of packages installed on the VirtualBox device and 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 Property
Installing Packages on Devices

Highlight search results