开始入门
复制一个设置提示,包含安装步骤和该插件的完整Markdown指南。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-is-root`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/is-root/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
您可以使用我们的AI辅助设置来安装插件。使用以下命令将Capgo技能添加到您的AI工具中:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins然后使用以下提示:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-is-root` plugin in my project.如果您更喜欢手动设置,请通过运行以下命令安装插件并遵循以下平台特定的说明:
bun add @capgo/capacitor-is-rootbunx cap sync导入
标题为“导入”import { IsRoot } from '@capgo/capacitor-is-root';API概述
标题为“API概述”isRooted
标题为“是否root”执行默认的root/jailbreak检测检查。
This is the recommended method for basic root/jailbreak detection. It runs a combination of the most reliable detection heuristics for the platform. Works on both Android and iOS.
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
标题:isRootedWithBusyBoxExtends the default detection with BusyBox specific checks (Android only).
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.isRootedWithBusyBox();detectRootManagementApps
标题:detectRootManagementAppsDetects if known root management applications are present (Android only).
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.detectRootManagementApps();detectPotentiallyDangerousApps
标题:detectPotentiallyDangerousAppsDetects potentially dangerous applications commonly found on rooted devices (Android only).
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.detectPotentiallyDangerousApps();detectTestKeys
标题:detectTestKeys检测到debug/test构建标签(仅限Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.detectTestKeys();checkForBusyBoxBinary
标题:检查BusyBox二进制文件检查设备上是否存在BusyBox二进制文件(仅限Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkForBusyBoxBinary();checkForSuBinary
标题:检查su二进制文件检查是否存在 su 二进制文件(仅限Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkForSuBinary();checkSuExists
标题:检查su是否存在检测 su 二进制文件是否可执行(仅限Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkSuExists();checkForRWPaths
标题:检查RW路径检测世界可写系统路径(仅限Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkForRWPaths();checkForDangerousProps
标题:检查危险系统属性检测危险系统属性(仅限Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkForDangerousProps();checkForRootNative
标题:执行RootBeer原生检查执行RootBeer原生检查(仅限Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkForRootNative();detectRootCloakingApps
标题:检测根目录伪装应用检测可以隐藏根目录的应用(仅限Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.detectRootCloakingApps();isSelinuxFlagInEnabled
标题:isSelinuxFlagInEnabled仅限 Android,检查 SELinux 强制执行状态(Android only)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.isSelinuxFlagInEnabled();isExistBuildTags
标题:isExistBuildTags仅限 Android,检测 OS 镜像上的测试构建标签 (Android only).
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.isExistBuildTags();doesSuperuserApkExist
标题:doesSuperuserApkExist仅限 Android,检测是否安装了超级用户 APK(Android only)
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.doesSuperuserApkExist();isExistSUPath
标题:isExistSUPath仅限 Android,检查已知路径(Android only) su 二进制位置(仅限 Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.isExistSUPath();checkDirPermissions
检查目录权限检测应保护的可写目录(仅限 Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkDirPermissions();checkExecutingCommands
执行命令执行 which su 样式命令以检测 root(仅限 Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkExecutingCommands();checkInstalledPackages
检查安装的包检测可疑的安装包(仅限 Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkInstalledPackages();checkforOverTheAirCertificates
检测 OTA 证书检测 Android 设备的 OTA 证书是否被篡改
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkforOverTheAirCertificates();isRunningOnEmulator
检测是否在模拟器上运行检测 Android 设备是否在模拟器上运行
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.isRunningOnEmulator();simpleCheckEmulator
轻量级模拟器检测复制到剪贴板
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.simpleCheckEmulator();simpleCheckSDKBF86
复制到剪贴板检测 Android 设备的 SDK 是否被篡改
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.simpleCheckSDKBF86();simpleCheckQRREFPH
Section titled “simpleCheckQRREFPH”检测QC参考手机构建(仅限Android)
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.simpleCheckQRREFPH();simpleCheckBuild
Section titled “simpleCheckBuild”检测构建主机异常(仅限Android)
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.simpleCheckBuild();checkGenymotion
Section titled “checkGenymotion”检测Genymotion模拟器指纹(仅限Android)
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkGenymotion();checkGeneric
Section titled “checkGeneric”检测通用模拟器指纹(仅限Android)
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkGeneric();checkGoogleSDK
Section titled “checkGoogleSDK”检测GoogleSDK模拟器指纹(仅限Android)
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkGoogleSDK();togetDeviceInfo
Section titled “togetDeviceInfo”返回检测过程中收集的设备信息.
提供了关于设备的额外上下文和元数据,用于调试和记录目的.
import { IsRoot } from '@capgo/capacitor-is-root';
const deviceInfo = await IsRoot.togetDeviceInfo();console.log('Device info:', deviceInfo);isRootedWithEmulator
Section titled “isRootedWithEmulator”扩展了默认检测,包括模拟器逻辑(仅限Android)
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.isRootedWithEmulator();isRootedWithBusyBoxWithEmulator
Section titled “isRootedWithBusyBoxWithEmulator”扩展了BusyBox检测,包括模拟器逻辑(仅限Android)
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.isRootedWithBusyBoxWithEmulator();类型参考
类型参考DetectionResult
检测结果根/破解检测方法返回的结果。
export interface DetectionResult { /** * `true` when the associated heuristic detects root/jailbreak artifacts. * `false` when no root/jailbreak indicators are found. * * @since 1.0.0 */ result: boolean;}DeviceInfo
设备信息在检测过程中收集的设备信息。
export interface DeviceInfo { /** * Arbitrary key/value device metadata populated by the native implementation. * Contents vary by platform and detection methods used. * * @since 1.0.0 */ [key: string]: any;}真实来源
来自插件的真实来源本页面是由插件生成的 src/definitions.ts. 当公共 API 上游发生变化时,请重新同步。
继续从 Getting Started
标题为“继续从 Getting Started”如果您正在使用 Getting Started 来规划仪表板和 API 操作,连接它到 使用 @capgo/capacitor-is-root 为本地能力的 Using @capgo/capacitor-is-root API Overview 为 API Overview 的实现细节 介绍 为介绍的实现细节, API 键 用于API 键的实现细节,以及 设备 用于设备的实现细节。