跳过主要内容

指南

Is Root教程

在设备上测试

Download the Capgo app, then scan the QR code.

Is Root插件预览二维码code

使用@capgo/capacitor-is-root

Capacitor Is Root插件,用于检测根设备(Android)或越狱设备(iOS)

安装

bun add @capgo/capacitor-is-root
bunx cap sync

此插件暴露的内容

  • isRooted - 执行默认的根/越狱检测检查。
  • isRootedWithBusyBox - 在Android上扩展默认检测,使用BusyBox特定的检查。
  • detectRootManagementApps - 检测是否存在已知的根管理应用程序(仅限Android)。
  • detectPotentiallyDangerousApps - 检测常见于根设备(仅限Android)的潜在危险应用程序。

- 使用示例

isRooted

- 执行默认的根/越狱检测检查。

import { IsRoot } from '@capgo/capacitor-is-root';

const { result } = await IsRoot.isRooted();
if (result) {
  console.log('Device is rooted/jailbroken');
} else {
  console.log('Device is not rooted/jailbroken');
}

isRootedWithBusyBox

扩展了默认检测,使用BusyBox特定检查(仅限Android)。

import { IsRoot } from '@capgo/capacitor-is-root';

await IsRoot.isRootedWithBusyBox();

detectRootManagementApps

检测已知的根管理应用程序是否存在(仅限Android)。

import { IsRoot } from '@capgo/capacitor-is-root';

await IsRoot.detectRootManagementApps();

detectPotentiallyDangerousApps

检测常见于根设备上的危险应用程序(仅限Android)。

import { IsRoot } from '@capgo/capacitor-is-root';

await IsRoot.detectPotentiallyDangerousApps();

全局参考

继续使用@capgo/capacitor-is-root

如果您正在使用 使用@capgo/capacitor-is-root 来规划原生插件工作,连接它到 @capgo/capacitor-is-root 为 @capgo/capacitor-is-root 的实现细节 开始使用 为 Getting Started 的实现细节 Capgo 插件目录 为 Capgo 插件目录 的产品工作流程 Capacitor 由 Capgo 提供的插件 为 Capacitor 由 Capgo 提供的插件 的实现细节, 添加或更新插件 为添加或更新插件 的实现细节