npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-android-packagemanager

v0.2.3

Published

Cordova plugin that exposes a small subset of the fuctions from the Android Package Manager.

Downloads

122

Readme


Title: Information Installed Applications description: Returns a custom list of applications installed on the system.

cordova-plugin-android-packagemanager

A Cordova plugin that exposes a small subset of the fuctions from the Android Package Manager. Currently:

  • PackageManager.getInstalledPackages(PackageManager.GET_META_DATA | PackageManager.GET_GIDS)
  • PackageManager.getInstallApplications(PackageManager.GET_META_DATA)
  • PackageManager.getPackageInfo(..) /* some flags supported, see usage */
  • PackageManager.queryIntentActivities(..) /* see usage for details */

Note that each of the functions also only returns a subset of the total data provided by the Package Manager classes.

Forked from a package by Fernando Arce (here).

Installation

There is currently no NPM package available for this fork, and no current current plans to make this available via a NPM repo.

cordova plugin add https://github.com/citadelgroup/cordova-plugin-android-packagemanager

Usage

In all cases the first two parameters to each function call are the success and error callbacks.

//Success Callback Receive
function successCallback(data) {
    console.log(data); 
}

//Error Callback Receive
function errorCallback(error) {
    console.log(error);
}

getInstalledPackages

The getInstalledPackages function calls the equivalently named function on the Android Package Manager class, see here. The flags parameter to this function is always PackageManager.GET_META_DATA | PackageManager.GET_GIDS.

window.plugins.packagemanager.getInstalledPackages(successCallback, errorCallback);

The function will always return an array (empty if no results). The array will be of the form:

[
    {
        applicationInfo: {
            dataDir: "/data/user/0/com.google.android.carriersetup"
            deviceProtectedDataDir: "/data/user_de/0/com.google.android.carriersetup"
            minSdkVersion: 28
            packageName: "com.google.android.carriersetup"
            processName: "com.google.android.carriersetup"
            targetSdkVersion: 28
            uid: 10146
            _extendedInfo: {
                applicationLabel: "Carrier Setup"
            }
        }
        firstInstallTime: 1230796800000
        gids: [ 3003 ]
        length: 1
        lastUpdateTime: 1230796800000
        packageName: "com.google.android.carriersetup"
        versionCode: 28
        versionName: "9"
    },
    ...
]

Note the _extendedInfo element in the results with the Application Label. This is not part of the standard results from Package Manager in the Application Info object and is provided for convenience.

getInstalledApplications

The getInstalledApplications function calls the equivalently named function on the Android Package Manager class, see here. The flags parameter to this function is always PackageManager.GET_META_DATA.

Unlike getInstalledPackages (above), getInstalledApplications does not return the package information, and therefore does not provide any package version information.

window.plugins.packagemanager.getInstalledApplications(
    successCallback,
    errorCallback
);

The function will always return an array (empty if no results). The array will be of the form:

[
    {
        dataDir: "/data/user/0/com.google.android.carriersetup"
        deviceProtectedDataDir: "/data/user_de/0/com.google.android.carriersetup"
        minSdkVersion: 28
        packageName: "com.google.android.carriersetup"
        processName: "com.google.android.carriersetup"
        targetSdkVersion: 28
        uid: 10146
        _extendedInfo: {
            applicationLabel: "Carrier Setup"
        }
    },
    ...
]

Note the _extendedInfo element in the results with the Application Label. This is not part of the standard results from Package Manager in the Application Info object and is provided for convenience.

getPackageInfo

The getPackageInfo function calls the equivalently named function on the Android Package Manager class, see here. This function allows a package to be queried by name (e.g. com.google.android.carriersetup), and may be supplied any, all or none of the flags PackageManager.GET_META_DATA, PackageManager.MATCH_SYSTEM_ONLY, PackageManager.GET_GIDS. If these values are supplied, they must be provided in a string array with only the constant value name (e.g. 'GET_META_DATA'). If the flags array is omittied this is equivalent to calling the function with flags = 0.

window.plugins.packagemanager.getPackageInfo(
    successCallback, 
    errorCallback, 
    'com.google.android.carriersetup', 
    ['GET_META_DATA', 'MATCH_SYSTEM_ONLY', 'GET_GIDS']
);

The function will always return an array (empty if no results). The array will be of the form:

[
    {
        applicationInfo: {
            dataDir: "/data/user/0/com.google.android.carriersetup"
            deviceProtectedDataDir: "/data/user_de/0/com.google.android.carriersetup"
            minSdkVersion: 28
            packageName: "com.google.android.carriersetup"
            processName: "com.google.android.carriersetup"
            targetSdkVersion: 28
            uid: 10146
            _extendedInfo: {
                applicationLabel: "Carrier Setup"
            }
        }
        firstInstallTime: 1230796800000
        gids: [ 3003 ]
        length: 1
        lastUpdateTime: 1230796800000
        packageName: "com.google.android.carriersetup"
        versionCode: 28
        versionName: "9"
    },
    ...
]

Note the _extendedInfo element in the results with the Application Label. This is not part of the standard results from Package Manager in the Application Info object and is provided for convenience.

queryIntentActivities

This intent query is intended to discover the 'runnable' activities on the device. The queryIntentActivities function calls the equivalently named function on the Android Package Manager class, see here.

The Intent parameter to this function is constructed as follows.

Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);

The flags parameter to this function is always PackageManager.GET_META_DATA.

window.plugins.packagemanager.queryIntentActivities(
    successCallback,
    errorCallback
);

The function will always return an array (empty if no results). The array will be of the form:

[
    {
        className: "org.chromium.chrome.browser.MonochromeApplication"
        dataDir: "/data/user/0/com.android.chrome"
        deviceProtectedDataDir: "/data/user_de/0/com.android.chrome"
        minSdkVersion: 24
        name: "org.chromium.chrome.browser.MonochromeApplication"
        packageName: "com.android.chrome"
        processName: "com.android.chrome"
        targetSdkVersion: 28
        uid: 10061
        _extendedInfo: {
            applicationLabel: "Chrome"
        }
    },
    ...
]

Note the _extendedInfo element in the results with the Application Label. This is not part of the standard results from Package Manager in the Application Info object and is provided for convenience.

Supported Platforms
  • Android