Skip to content

Get App Info

Summary

  • Internal name: GetAppInfo
  • Category: Package Manager
  • Purpose: Retrieve detailed information about an installed application from its package name: version, label, install dates, target SDK, APK size, and system/enabled flags.
  • Task type: Normal

Compatibility

  • Minimum AndroMate version: 1.1.0

  • Maximum AndroMate version: 1.1.0

  • Minimum Android: Android 13 (API 33)

  • Maximum Android tested: Android 16 (API 36)

  • Required permissions: QUERY_ALL_PACKAGES


Detailed description

The Get App Info task queries the Android PackageManager for a single package and returns all available metadata. Each piece of information is written to its own optional output variable — only the outputs you fill in are stored, the rest are ignored.

Since Android 11 (API 30), apps cannot see other installed packages by default (package visibility filtering). AndroMate declares the QUERY_ALL_PACKAGES permission so it can query any installed package by name.

If the package is not installed, the task throws PACKAGE-MANAGER-ERROR-001.


Input parameters

Parameter Type Required Possible values / Rules Android Compatibility AndroMate Compatibility Default
package_name String Yes Valid Android package name (com.example.app) Android 13 (API 33) → Android 16 (API 36) 1.1.0 → 1.1.0 ""

Output parameters

All outputs are optional — leave a field empty to skip it.

Field Type Trigger condition Android Compatibility AndroMate Compatibility Default
version_name_output String App version name (e.g. "2.5.1") Android 13 (API 33) → Android 16 (API 36) 1.1.0 → 1.1.0 <ANDROMATE_NULL_VALUE>
version_code_output Long Integer version code (e.g. 150) Android 13 (API 33) → Android 16 (API 36) 1.1.0 → 1.1.0 <ANDROMATE_NULL_VALUE>
app_name_output String App display label (e.g. "WhatsApp") Android 13 (API 33) → Android 16 (API 36) 1.1.0 → 1.1.0 <ANDROMATE_NULL_VALUE>
first_install_output Long First install timestamp (ms) Android 13 (API 33) → Android 16 (API 36) 1.1.0 → 1.1.0 <ANDROMATE_NULL_VALUE>
last_update_output Long Last update timestamp (ms) Android 13 (API 33) → Android 16 (API 36) 1.1.0 → 1.1.0 <ANDROMATE_NULL_VALUE>
target_sdk_output Long Target SDK API level (e.g. 34) Android 13 (API 33) → Android 16 (API 36) 1.1.0 → 1.1.0 <ANDROMATE_NULL_VALUE>
apk_size_output Long APK file size in bytes Android 13 (API 33) → Android 16 (API 36) 1.1.0 → 1.1.0 <ANDROMATE_NULL_VALUE>
is_system_output String "true" if system app, else "false" Android 13 (API 33) → Android 16 (API 36) 1.1.0 → 1.1.0 <ANDROMATE_NULL_VALUE>
is_enabled_output String "true" if enabled, else "false" Android 13 (API 33) → Android 16 (API 36) 1.1.0 → 1.1.0 <ANDROMATE_NULL_VALUE>

Exceptions

Code Trigger condition
PACKAGE-MANAGER-ERROR-001 The package is not installed on the device

Execution flowchart

flowchart TD
    Start([▶ GetAppInfo]) --> Resolve[🔧 Resolve package_name]

    Resolve --> Query[📦 PackageManager.getPackageInfo]

    Query --> Found{Package found ?}

    Found -->|No| Throw([❌ PACKAGE-MANAGER-ERROR-001])
    Found -->|Yes| Read[📖 Read version, label, dates,\ntarget SDK, APK size, flags]

    Read --> Store[💾 Set output variables\nAppInfoTaskResult]

    Store --> Success([✅ AppInfoTaskResult])

    style Start fill:#e3f2fd
    style Success fill:#c8e6c9
    style Throw fill:#ffcdd2
    style Query fill:#fff9c4
    style Read fill:#f3e5f5
    style Store fill:#c8e6c9

How it works:

  1. Resolve: the package_name is resolved against the AndroMate context
  2. Query: PackageManager.getPackageInfo() is called with the package name
  3. Check: if the package is not found, the task throws PACKAGE-MANAGER-ERROR-001
  4. Read: version, label, install/update timestamps, target SDK, APK size, and flags are read
  5. Store: each requested output variable is filled
  6. Result: returns AppInfoTaskResult

Code examples

Example 1 — Read the version of WhatsApp

{
  "GetAppInfo": [
    {
      "id": "1",
      "title": "WhatsApp version",
      "package_name": "com.whatsapp",
      "version_name_output": "$wa_version",
      "version_code_output": "$wa_code"
    }
  ]
}

Example 2 — Full metadata dump

{
  "GetAppInfo": [
    {
      "id": "2",
      "title": "App full info",
      "package_name": "com.instagram.android",
      "app_name_output": "$name",
      "version_name_output": "$ver",
      "target_sdk_output": "$sdk",
      "apk_size_output": "$size",
      "is_system_output": "$is_sys",
      "is_enabled_output": "$is_on"
    }
  ]
}

Input parameter details

package_name — Target package

The Android package identifier of the app to inspect.

  • Must be a valid, installed package name (e.g. com.whatsapp)
  • Supports variable interpolation (e.g. $target_pkg, ${PKG})
  • If the package is not installed, the task throws PACKAGE-MANAGER-ERROR-001

Output parameter details

All output variables are optional. Leave a field empty to skip writing that value.

version_name_output — Version name

Human-readable version string as displayed to users (e.g. "2.5.1").

version_code_output — Version code

Monotonic integer used internally for update comparison (e.g. 150). Read via getLongVersionCode().

app_name_output — Application label

The display name of the app as shown in the launcher (e.g. "WhatsApp").

first_install_output — First install time

Timestamp in milliseconds since epoch when the app was first installed.

last_update_output — Last update time

Timestamp in milliseconds since epoch of the most recent update. Equals first_install_output if never updated.

target_sdk_output — Target SDK version

The API level the app targets (e.g. 34 for Android 14).

apk_size_output — APK size

Size of the base APK file in bytes.

is_system_output — System app flag

"true" if the app is a pre-installed system app (FLAG_SYSTEM), "false" otherwise.

is_enabled_output — Enabled flag

"true" if the app is currently enabled, "false" if disabled.


Complete JSON example

{
  "GetAppInfo": [
    {
      "id": "1",
      "title": "Get App Info",
      "package_name": "com.whatsapp",
      "version_name_output": "$APP_VERSION",
      "app_name_output": "$APP_NAME"
    }
  ]
}