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

capacitor-android-install

v0.0.1

Published

Capacitor plugin for Android APK installation

Readme

capacitor-android-install

Capacitor插件,用于在Android设备上安装本地APK文件。

支持平台

  • Android 7.0+ (API级别24+)

Install

npm install capacitor-android-install
npx cap sync

基本用法

import { AndroidInstall } from 'capacitor-android-install';

// 安装本地APK文件
async function installApk() {
  try {
    const result = await AndroidInstall.installApk({
      filePath: '/storage/emulated/0/Download/app-update.apk'
    });
    console.log('Installation started:', result.success);
  } catch (error) {
    console.error('Installation failed:', error);
  }
}

注意: filePath 必须是设备上的绝对路径,建议搭配 @capacitor/filesystem@capacitor/file-transfer 插件使用,先获取文件路径,再下载到指定目录,最后调用该插件安装; @capacitor/filesystem插件获取的目录会有前缀file://,需自行去除;

权限配置

AndroidManifest.xml 中,插件已经包含了必要的权限声明和FileProvider配置:

<!-- 安装未知来源应用的权限(Android 8.0+需要) -->
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

<!-- FileProvider配置,用于Android 7.0+的文件共享 -->
<provider
    android:name="androidx.core.content.FileProvider"
    android:authorities="${applicationId}.fileprovider"
    android:exported="false"
    android:grantUriPermissions="true">
    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/file_paths" />
</provider>

file_paths示例,此处举例 Download 目录

<!-- file_paths.xml -->
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <external-path name="download" path="download/"/>
</paths>

注意事项

插件不会自动处理前缀,需使用设备上的绝对路径,如 /storage/emulated/0/Download/app-update.apk;