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

expo-install-apps

v1.0.24

Published

show install apps information

Readme

expo-install-apps

提供获取设备安装应用列表和安装权限管理的Expo模块

github 地址: https://github.com/mowatermelon/expo-app-list

安装

npx expo install expo-install-apps

配置

在app.json中添加插件配置:

{
  "plugins": [
    [
      "expo-install-apps",
      {
        "androidPermissionDescription": "Allow $(PRODUCT_NAME) to install packages",
        "iosSchemes": ["itms-apps"]
      }
    ]
  ]
}

API参考

requestPermissionsAsync()

请求安装未知来源应用的权限

返回 Promise

getInstalledApps()

获取已安装应用列表

返回 Promise<AppInfo[]>

addAppsChangeListener(listener)

监听应用安装/更新/卸载事件

参数:

  • listener: (event: AppsChangeEvent) => void

返回 Subscription

useInstallAppInfo()

集成权限管理的React Hook

返回 [PermissionResponse, requestPermission: () => Promise]

类型定义

type AppInfo = {
  appName: string;
  packageName: string;
  iconBase64: string;
  versionCode: number;
  isSystemApp: boolean;
  installTime: number;
};

enum AppChangeType {
  INSTALLED = "installed",
  UPDATED = "updated",
  UNINSTALLED = "uninstalled",
}

type AppsChangeEvent = {
  type: AppChangeType;
  apps: AppInfo[];
};

interface PermissionResponse {
  status: PermissionStatus;
  granted: boolean;
  canAskAgain: boolean;
  expires: "never";
}

平台要求

| 平台 | 版本要求 | 权限要求 | | ------- | -------- | ---------------------------- | | Android | 5.0+ | 需要QUERY_ALL_PACKAGES权限 | | iOS | 11.0+ | 无需额外权限 |

高级配置

Android

自动添加以下权限:

<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />

iOS

自动配置应用白名单:

<key>LSApplicationQueriesSchemes</key>
<array>
  <string>itms-apps</string>
  <string>itms-beta</string>
</array>

使用流程

1. 权限检查与请求

import ExpoInstall, { PermissionStatus } from "expo-install-apps";

useEffect(() => {
  const checkPermission = async () => {
    const { status } = await ExpoInstall.requestPermissionsAsync();
    if (status !== PermissionStatus.GRANTED) {
      console.log("需要手动开启安装权限");
      // Android需要跳转到设置页面
      if (Platform.OS === "android") {
        Linking.openSettings();
      }
    }
  };
  checkPermission();
}, []);

2. 初始应用列表加载

import ExpoInstall from "expo-install-apps";

const loadInstalledApps = async () => {
  try {
    const apps = await ExpoInstall.getInstalledApps();
    setApps(apps);
  } catch (error) {
    console.error("获取应用列表失败:", error);
  }
};

// 在权限授予后调用
useEffect(() => {
  if (permission.granted) {
    loadInstalledApps();
  }
}, [permission.granted]);

3. 实时监听应用变更

import ExpoInstall, type { AppsChangeEvent } from "expo-install-apps";

useEffect(() => {
  const subscription = ExpoInstall.addAppsChangeListener((event) => {
    switch (event.type) {
      case AppChangeType.INSTALLED:
        setApps((prev) => [...prev, ...event.apps]);
        break;
      case AppChangeType.UPDATED:
        // 处理应用更新逻辑
        break;
      case AppChangeType.UNINSTALLED:
        // 处理应用卸载逻辑
        break;
    }
  });

  return () => subscription.remove();
}, []);

平台差异说明

  • Android: 需要动态请求REQUEST_INSTALL_PACKAGES权限,未授权时需引导用户到系统设置
  • iOS: 仅支持监听应用安装/更新事件,无法获取完整应用列表

示例

import ExpoInstall, {
  AppInfo,
  AppsChangeEvent,
  useInstallAppInfo,
  AppChangeType,
} from "expo-install-apps";

function AppList() {
  const [apps, setApps] = useState<AppInfo[]>([]);
  const [permission] = useInstallAppInfo();

  useEffect(() => {
    const subscription = ExpoInstall.addAppsChangeListener((event) => {
      if (event.type === "installed") {
        setApps((prev) => [...prev, ...event.apps]);
      }
    });

    return () => subscription.remove();
  }, []);

  if (!permission.granted) {
    return <Text>需要开启安装权限</Text>;
  }

  return (
    <FlatList
      data={apps}
      renderItem={({ item }) => (
        <View style={{ padding: 10 }}>
          <Image
            source={{ uri: `data:image/png;base64,${item.iconBase64}` }}
            style={{ width: 40, height: 40 }}
          />
          <Text>
            {item.appName} ({item.packageName})
          </Text>
        </View>
      )}
    />
  );
}

贡献

欢迎通过 GitHub 提交 issue 或 pull request