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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@capgo/capacitor-android-usagestatsmanager

v8.0.23

Published

Exposes the Android's UsageStatsManager SDK to Capacitor

Readme

@capgo/capacitor-android-usagestatsmanager

Description

Exposes the Android's UsageStatsManager SDK to Capacitor

Why Android UsageStatsManager?

The only plugin exposing Android's UsageStatsManager API to Capacitor - this Android API was not supported by any plugin before:

  • App usage tracking - Monitor which apps users open and for how long
  • Screen time analytics - Build parental controls and digital wellbeing features
  • Package information - Query all installed apps on the device
  • Time-based queries - Get usage stats for any time range

Perfect for parental control apps, digital wellbeing tools, productivity trackers, and screen time managers.

Usage

Requires the following permissions in your AndroidManifest.xml:

<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"
    tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
    tools:ignore="QueryAllPackagesPermission" />

Documentation

The most complete doc is available here: https://capgo.app/docs/plugins/android-usagestatsmanager/

Compatibility

| Plugin version | Capacitor compatibility | Maintained | | -------------- | ----------------------- | ---------- | | v8.*.* | v8.*.* | ✅ | | v7.*.* | v7.*.* | On demand | | v6.*.* | v6.*.* | ❌ | | v5.*.* | v5.*.* | ❌ |

Note: The major version of this plugin follows the major version of Capacitor. Use the version that matches your Capacitor installation (e.g., plugin v8 for Capacitor 8). Only the latest major version is actively maintained.

Install

npm install @capgo/capacitor-android-usagestatsmanager
npx cap sync

API

Capacitor plugin for accessing Android UsageStatsManager API.

queryAndAggregateUsageStats(...)

queryAndAggregateUsageStats(options: UsageStatsOptions) => Promise<Record<string, UsageStats>>

Queries and aggregates usage stats for the given time range.

| Param | Type | Description | | ------------- | --------------------------------------------------------------- | -------------------------------------- | | options | UsageStatsOptions | - The time range options for the query |

Returns: Promise<Record<string, UsageStats>>

Since: 1.0.0


isUsageStatsPermissionGranted()

isUsageStatsPermissionGranted() => Promise<UsageStatsPermissionResult>

Checks if the usage stats permission is granted.

Returns: Promise<UsageStatsPermissionResult>

Since: 1.0.0


openUsageStatsSettings()

openUsageStatsSettings() => Promise<void>

Open the usage stats settings screen. This will open the usage stats settings screen, which allows the user to grant the usage stats permission. This will always open the settings screen, even if the permission is already granted.

Since: 1.0.0


queryAllPackages()

queryAllPackages() => Promise<{ packages: PackageInfo[]; }>

Queries all installed packages on the device. Requires the QUERY_ALL_PACKAGES permission.

Returns: Promise<{ packages: PackageInfo[]; }>

Since: 1.2.0


getPluginVersion()

getPluginVersion() => Promise<{ version: string; }>

Get the native Capacitor plugin version.

Returns: Promise<{ version: string; }>

Since: 1.0.0


Interfaces

UsageStats

Usage statistics for an Android app.

| Prop | Type | Description | | ----------------------------------- | ------------------- | -------------------------------------------------------------------------------------------------- | | firstTimeStamp | number | The first timestamp of the usage stats. | | lastTimeStamp | number | The last timestamp of the usage stats. | | lastTimeForegroundServiceUsed | number | Only available on Android Q (API level 29) and above. Will be undefined on lower Android versions. | | lastTimeUsed | number | The last time the app was used. | | lastTimeVisible | number | Only available on Android Q (API level 29) and above. Will be undefined on lower Android versions. | | packageName | string | The name of the package. | | totalForegroundServiceUsed | number | Only available on Android Q (API level 29) and above. Will be undefined on lower Android versions. | | totalTimeInForeground | number | The total time the app was in the foreground. | | totalTimeVisible | number | Only available on Android Q (API level 29) and above. Will be undefined on lower Android versions. |

UsageStatsOptions

Options for querying usage statistics.

| Prop | Type | Description | | --------------- | ------------------- | -------------------------------------------------------------------------------------------------------- | | beginTime | number | The inclusive beginning of the range of stats to include in the results. Defined in terms of "Unix time" | | endTime | number | The exclusive end of the range of stats to include in the results. Defined in terms of "Unix time" |

UsageStatsPermissionResult

Result of a usage stats permission check.

| Prop | Type | Description | | ------------- | -------------------- | ---------------------------------------------- | | granted | boolean | Whether the usage stats permission is granted. |

PackageInfo

Represents basic information about an installed package.

| Prop | Type | Description | | ---------------------- | ------------------- | ---------------------------------------------- | | packageName | string | Package name | | appName | string | App display name | | versionName | string | Version name string | | versionCode | number | Version code number | | firstInstallTime | number | First install time in milliseconds since epoch | | lastUpdateTime | number | Last update time in milliseconds since epoch |

Type Aliases

Record

Construct a type with a set of properties K of type T

{ [P in K]: T; }