Skip to content

Version 1.0.4

Latest

Choose a tag to compare

@CarlosSTS CarlosSTS released this 23 Sep 17:20
0d18399

What's new

Installed-app insights for Android (#3).

New methods

  • getInstalledApps(options?): lists launchable apps with their metadata: name, version, install/update time, target/min SDK, category, requested permission count, system flag and an optional base64 icon. When "Usage access" is granted it also returns foreground time, last-used time, launch count and storage size (app / data / cache /
    • Options: includeSystemApps, includeIcons, sortBy (totalSize | usageTime | lastUsed | name), usagePeriod (day | week | month | year), limit.
    • Runs on a background thread.
  • hasUsageAccessPermission(): checks whether PACKAGE_USAGE_STATS is granted.
  • openUsageAccessSettings(): opens the system "Usage access" screen.
  • openAppSettings(packageName): opens the system "App info" screen for a package.
  • getDeviceMemoryInfo(): device-wide RAM snapshot (total, available, used, low-memory flag and threshold).

Android manifest (merged into your app)

The library now ships an AndroidManifest.xml that adds:

  • android.permission.PACKAGE_USAGE_STATS: a special permission the user grants in Settings. It is only needed for the usage and storage fields.
  • <queries> for MAIN/LAUNCHER and geo: VIEW intents, so app listing and openAppWithLocation work on Android 11+ without QUERY_ALL_PACKAGES.

If your app doesn't use getInstalledApps and you don't want the permission declared, remove it with:

<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" tools:node="remove" />

Other changes

  • The TurboModule type is now imported from react-native instead of the deep react-native/Libraries/TurboModule/RCTExport path.
  • README: docs for the new APIs and a local-development guide.

Notes

  • Per-app RAM usage is not available: Android has no Play-compliant API for it.
  • launchCount counts foreground transitions in the period, so it can be higher than the actual number of app launches.

Full Changelog: v1.0.3...v1.0.4