@capgo/capacitor-android-usagestatsmanager
Overview
Section titled “Overview”Access Android usage statistics to track app usage time and screen time analytics
Start with queryAndAggregateUsageStats() and the other core methods listed below.
Platform support
Section titled “Platform support”| Platform | Support | Notes |
|---|---|---|
| iOS | Yes | Native |
| Android | Yes | Native |
| Web | No | Guard with Capacitor.getPlatform() |
Core Capabilities
Section titled “Core Capabilities”queryAndAggregateUsageStats- Queries and aggregates usage stats for the given time range.isUsageStatsPermissionGranted- Checks if the usage stats permission is granted.openUsageStatsSettings- 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.queryAllPackages- Queries all installed packages on the device. Requires the QUERY_ALL_PACKAGES permission.
Public API
Section titled “Public API”| Method | Description |
|---|---|
queryAndAggregateUsageStats | Queries and aggregates usage stats for the given time range. |
isUsageStatsPermissionGranted | Checks if the usage stats permission is granted. |
openUsageStatsSettings | 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. |
queryAllPackages | Queries all installed packages on the device. Requires the QUERY_ALL_PACKAGES permission. |
getPluginVersion | Get the native Capacitor plugin version. |
Source Of Truth
Section titled “Source Of Truth”This reference is synced from src/definitions.ts in capacitor-android-usagestatsmanager.
Keep going from @capgo/capacitor-android-usagestatsmanager
Section titled “Keep going from @capgo/capacitor-android-usagestatsmanager”If you are using @capgo/capacitor-android-usagestatsmanager to plan native plugin work, connect it with Using @capgo/capacitor-android-usagestatsmanager for the native capability in Using @capgo/capacitor-android-usagestatsmanager, Capgo Plugin Directory for the product workflow in Capgo Plugin Directory, Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, Adding or Updating Plugins for the implementation detail in Adding or Updating Plugins, and Ionic Enterprise Plugin Alternatives for the product workflow in Ionic Enterprise Plugin Alternatives.