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

@bryce3310687963/android-toolkit

v1.0.60

Published

Native Android automation toolkit for Apify-compatible actors.

Readme

Android Toolkit

@bryce3310687963/android-toolkit is the native Android counterpart to @skrillex1224/playwright-toolkit.

Actor code should import only useAndroidToolKit() and then use the returned modules. The public API is intentionally small and destructive from v1 onward.

import { useAndroidToolKit } from '@bryce3310687963/android-toolkit';

const { Launch } = useAndroidToolKit();

await Launch.run(async ({ ctx, kit }) => {
  const { ApifyKit, DeviceInput, Mutation, Share } = kit;
  await ApifyKit.runStep('输入并发送', ctx, async () => {
    await DeviceInput.click(ctx, { id: 'input_text' });
    await DeviceInput.fill(ctx, { id: 'input_text' }, ctx.query);
    await DeviceInput.click(ctx, { id: 'action_send' });
  });
  await Mutation.waitForStable(ctx, { id: 'message_list' });
  const screenshotBase64 = await Share.captureScreen(ctx);
  await ApifyKit.pushArtifact({ screenshotBase64 });
});

Public Modules

| Module | Responsibility | | --- | --- | | Launch | Native actor entrypoint with fixed /apify_storage/input.json and /apify_storage/output.json paths plus lifecycle hooks. | | ApifyKit | runStep, runStepLoose, pushSuccess, pushFailed, pushArtifact. | | Device | Low-level ADB primitives only. | | DeviceView | Native View-tree snapshot and selector lookup over uiautomator dump. | | DeviceInput | View-tree-backed click/fill/press/scroll APIs using ADB input. | | Mutation | Playwright-like stable wait semantics over matched ViewNode subtrees. | | Share | Sprite screenshot and clipboard share-link polling. | | DeviceSQLite | Root ADB-backed private SQLite snapshot queries. | | Constants | Native-useful actor metadata and codes. | | Errors | CrawlerError and error serialization. |

Runtime Contract

The toolkit does not install or discover runtime tools.

Required environment:

  • ANDROID_TOOLKIT_ADB_PATH

Device initialization, Appium Settings, UnicodeIME, and root ADB access belong to manager/cluster runtime. Runtime checks fail clearly when prerequisites are missing.

Boundaries

Included:

  • ADB command execution, app launch, key input, screenshot, activity checks.
  • View-tree parsing with a real XML parser.
  • View selector operations: id, text, textContains, contentDesc, className.
  • Root ADB-backed SQLite queries through DeviceSQLite.query() only.

Excluded:

  • Public generic process injection or app hook execution.
  • App hook clipboard helpers.
  • WebView event recorder.
  • App hook UI traversal/click helpers.
  • Package name and activity truth. Backend/runtime input owns those values.
  • Actor-specific DB schemas, message parsing, product parsing, and success criteria.

Android Actor Rules

  • Do not use hardcoded absolute coordinates, screen-ratio coordinates, or naked point taps in actor code.
  • Do not add fallback clicks. If the expected selector, DOM element, activity, or key-driven flow is unavailable, fail with a typed error and useful context.
  • UI actions must be driven by one of: native DeviceView selectors, WebView DOM actions, Android activity/intents, or deterministic key events with activity/state verification.
  • If an app renders custom UI that is invisible to uiautomator, use a stable app/runtime capability instead of guessing screen positions.
  • Bounds-based taps are allowed only when the bounds come from a located native view; WebView clicks must stay in WebView.click/WebView.evaluate.

Browser Entry

@bryce3310687963/android-toolkit/browser exports only Constants and Errors.

Clear App Cache

Device.writeCacheFile(ctx, { dirName, fileName, text }) writes text directly to /data/data/<package>/cache/<dirName>/<fileName> with root, sets app ownership, and returns the device path. Its ADB command arguments and raw command errors are redacted, including retries, so file contents do not enter logs or error reports. Callers that stage credentials must remove the temporary files after use.

Device.clearAppCache(ctx, packageName = ctx.packageName) requires root ADB access. Stop the app before clearing its cache, then launch it again:

await Device.forceStopApp(ctx);
await Device.clearAppCache(ctx);
await Device.startLauncher(ctx);

This clears the contents of /data/data/<package>/cache, /data/data/<package>/code_cache, and /sdcard/Android/data/<package>/cache. It preserves the cache directories themselves and toolkit runtime directories apify-webview-bridge and network-capture. Databases, preferences, files, WebView cookies, and login data are outside the cleanup scope. Missing cache directories are skipped; invalid package names and cleanup errors fail the call. Each actor chooses whether to call this method; Launch.run does not clear caches automatically.

Reset Rebuildable App Databases

DeviceSQLite.reset(ctx, { dbNamePrefix }) requires root ADB access and a stopped app. It removes regular files beginning with the explicitly supplied prefix from /data/data/<package>/databases, including their WAL, SHM, and journal files. The app recreates those databases when launched. This resets entire matching databases, not individual table rows; use it only for databases the app can rebuild. Other databases, preferences, files, and login configuration are preserved. Missing databases are skipped. Invalid targets, symbolic links, unexpected directories, and deletion errors fail the call.

await Device.forceStopApp(ctx);
await Device.clearAppCache(ctx);
await DeviceSQLite.reset(ctx, { dbNamePrefix: 'chat_database_' });
await Device.startLauncher(ctx);

Database prefixes belong in actor code. Local resets do not delete cloud history; the app may download old conversations again after launching.

Native 进程内调用

1.0.57 起,Node 入口和 Launch kit 提供 Native.invoke(ctx, program) 与 Native.session(ctx, profile, run, options),需要 Bridge 1.0.13+。项目传入版本、类名、明确的方法签名、参数及 JSON 返回投影;Bridge 不保存 App 专用逻辑。

详细协议、表达式、超时/互斥语义和真实项目示例见仓库 java-apify-android-bridge/docs/native-calls.md。long 大整数使用字符串,Java 对象引用仅在单次命令有效。业务循环、等待和最终确认留在各项目,未知完成状态不自动重发。