Packagecom.distriqt.extension.packagemanager
Classpublic final class PackageManager
InheritancePackageManager Inheritance flash.events.EventDispatcher

This class represents the PackageManager extension.



Public Properties
 PropertyDefined By
  canRequestApplicationInstalls : Boolean
[read-only] Checks whether the calling package is allowed to request package installs through package installer.
PackageManager
  implementation : String
[read-only] The implementation currently in use.
PackageManager
  isSupported : Boolean
[static] [read-only] Whether the current device supports the extensions functionality
PackageManager
  nativeVersion : String
[read-only] The native version string of the native extension.
PackageManager
  service : PackageManager
[static] [read-only] The singleton instance of the PackageManager class.
PackageManager
  version : String
[read-only] The version of this extension.
PackageManager
Public Methods
 MethodDefined By
  
Constructor You should not call this directly, but instead use the singleton access
PackageManager
  
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
[override]
PackageManager
  
dispose():void
Disposes the extension and releases any allocated resources.
PackageManager
  
getInstalledApplications(flags:int = 0):Array
Return an Array of all application packages that are installed for the current user.
PackageManager
  
getInstalledApplicationsAsync(callback:Function = null, flags:int = 0):void
PackageManager
  
Retrieve the package name of the application that installed a package.
PackageManager
  
getPackageInfo(packageName:String, flags:int = 0):PackageInfo
Retrieves the package information for the specified package name Note: You will need to add the package name to the queries node in your manifest additions
PackageManager
  
installApplication(applicationPath:String):Boolean
Launch application installer
PackageManager
  
killProcess(processName:String):Boolean
Attempts to force terminate or "kill" a running process / activity with the given processName.
PackageManager
  
Show settings to allow configuration of trusted external sources
PackageManager
  
validateSignature(signature:String):Boolean
Checks if the apk signature is valid
PackageManager
  
Verifies if the application was installed using the Google Play Store.
PackageManager
Events
 Event Summary Defined By
   PackageManager
Public Constants
 ConstantDefined By
  EXT_CONTEXT_ID : String = com.distriqt.PackageManager
[static]
PackageManager
  VERSION : String = 3.4.1
[static]
PackageManager
Property Detail
canRequestApplicationInstallsproperty
canRequestApplicationInstalls:Boolean  [read-only]

Checks whether the calling package is allowed to request package installs through package installer. Apps are encouraged to call this API before launching the package installer Starting from Android O, the user can explicitly choose what external sources they trust to install apps on the device. If this API returns false, the install request will be blocked by the package installer and a dialog will be shown to the user with an option to launch settings to change their preference. An application must target Android O or higher and declare permission Manifest.permission.REQUEST_INSTALL_PACKAGES in order to use this API.


Implementation
    public function get canRequestApplicationInstalls():Boolean
implementationproperty 
implementation:String  [read-only]

The implementation currently in use. This should be one of the following depending on the platform in use and the functionality supported by this extension:


Implementation
    public function get implementation():String
isSupportedproperty 
isSupported:Boolean  [read-only]

Whether the current device supports the extensions functionality


Implementation
    public static function get isSupported():Boolean
nativeVersionproperty 
nativeVersion:String  [read-only]

The native version string of the native extension.


Implementation
    public function get nativeVersion():String
serviceproperty 
service:PackageManager  [read-only]

The singleton instance of the PackageManager class.


Implementation
    public static function get service():PackageManager

Throws
Error — If there was a problem creating or accessing the extension, or if the key is invalid
versionproperty 
version:String  [read-only]

The version of this extension.

This should be of the format, MAJOR.MINOR.BUILD


Implementation
    public function get version():String
Constructor Detail
PackageManager()Constructor
public function PackageManager()

Constructor You should not call this directly, but instead use the singleton access

Method Detail
addEventListener()method
override public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void

Parameters

type:String
 
listener:Function
 
useCapture:Boolean (default = false)
 
priority:int (default = 0)
 
useWeakReference:Boolean (default = false)

dispose()method 
public function dispose():void

Disposes the extension and releases any allocated resources. Once this function has been called, a call to init is neccesary again before any of the extensions functionality will work.

getInstalledApplications()method 
public function getInstalledApplications(flags:int = 0):Array

Return an Array of all application packages that are installed for the current user.

Parameters

flags:int (default = 0) — unused

Returns
Array — An Array of PackageInfo objects or null if the functionality is not supported

See also

getInstalledApplicationsAsync()method 
public function getInstalledApplicationsAsync(callback:Function = null, flags:int = 0):void

Parameters

callback:Function (default = null)
 
flags:int (default = 0)

getInstallerPackageName()method 
public function getInstallerPackageName():String

Retrieve the package name of the application that installed a package. This identifies which market the package came from.

This may be null or an empty string in situations where the application was side loaded. For applications installed from the Google Play Store this will be equal to com.android.vending.

Returns
String — The package name of the installer application
getPackageInfo()method 
public function getPackageInfo(packageName:String, flags:int = 0):PackageInfo

Retrieves the package information for the specified package name Note: You will need to add the package name to the queries node in your manifest additions

                  

Parameters

packageName:String — The package name of the application to query
 
flags:int (default = 0) — unused

Returns
PackageInfoPackageInfo representing the queried application package or null if the application isn't installed or access was denied o
installApplication()method 
public function installApplication(applicationPath:String):Boolean

Launch application installer

Parameters

applicationPath:String — Path at which the application can be retrieved

Returns
Boolean
killProcess()method 
public function killProcess(processName:String):Boolean

Attempts to force terminate or "kill" a running process / activity with the given processName.

Parameters

processName:String — The name of the process to terminate

Returns
Booleantrue if the process name was found and termination attempted
showManageUnknownAppSourcesSettings()method 
public function showManageUnknownAppSourcesSettings():void

Show settings to allow configuration of trusted external sources

validateSignature()method 
public function validateSignature(signature:String):Boolean

Checks if the apk signature is valid

Parameters

signature:String — The certificate signature

Returns
Booleantrue if the signature is valid and false otherwise
wasInstalledFromPlayStore()method 
public function wasInstalledFromPlayStore():Boolean

Verifies if the application was installed using the Google Play Store. This is the equivalent of checking the installer package name is com.android.vending.

Returns
Booleantrue if the application was installed using Google Play and false if not.

See also

Event Detail
packagemanager:packageremoved Event
Event Object Type: com.distriqt.extension.packagemanager.events.PackageManagerEvent
PackageManagerEvent.type property = com.distriqt.extension.packagemanager.events.PackageManagerEvent.PACKAGE_REMOVED

Constant Detail
EXT_CONTEXT_IDConstant
public static const EXT_CONTEXT_ID:String = com.distriqt.PackageManager

VERSIONConstant 
public static const VERSION:String = 3.4.1