开始使用
复制一个包含安装步骤和完整 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.
安装
安装bun add @capgo/capacitor-is-rootbunx cap sync导入
导入import { IsRoot } from '@capgo/capacitor-is-root';API概述
API概述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
“isRootedWithBusyBox”仅限 Android,使用 BusyBox 特定的检查来扩展默认检测。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.isRootedWithBusyBox();detectRootManagementApps
“detectRootManagementApps”仅限 Android,检测已知的根管理应用程序是否存在。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.detectRootManagementApps();detectPotentiallyDangerousApps
“detectPotentiallyDangerousApps”仅限 Android,检测常见于根设备上的潜在危险应用程序。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.detectPotentiallyDangerousApps();detectTestKeys
“detectTestKeys”仅限 Android,检测调试/测试构建标签。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.detectTestKeys();checkForBusyBoxBinary
Section titled “checkForBusyBoxBinary”仅在 Android 设备上检查是否存在 BusyBox 二进制文件。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkForBusyBoxBinary();checkForSuBinary
Section titled “checkForSuBinary”仅在 Android 设备上检查是否存在 su 复制到剪贴板
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkForSuBinary();checkSuExists
检测 Android 设备上是否存在并可执行 复制到剪贴板 su Section titled “checkForRWPaths”
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkSuExists();checkForRWPaths
复制到剪贴板检测世界可写的系统路径(仅限Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkForRWPaths();checkForDangerousProps
“checkForDangerousProps”标题检测危险的系统属性(仅限Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkForDangerousProps();checkForRootNative
“checkForRootNative”标题执行RootBeer本机检查(仅限Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkForRootNative();detectRootCloakingApps
“detectRootCloakingApps”标题检测可以隐藏root的应用程序(仅限Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.detectRootCloakingApps();isSelinuxFlagInEnabled
“isSelinuxFlagInEnabled”标题检查 SELinux 执行状态 (仅限 Android )。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.isSelinuxFlagInEnabled();isExistBuildTags
标题: “isExistBuildTags” 检测操作系统镜像上的测试构建标签 (仅限 Android )。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.isExistBuildTags();doesSuperuserApkExist
标题: “doesSuperuserApkExist” 检测是否安装了超级用户 APK (仅限 Android )。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.doesSuperuserApkExist();isExistSUPath
标题: “isExistSUPath” 检查已知 su 二进制位置 (仅限 Android )。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.isExistSUPath();checkDirPermissions
Section titled “checkDirPermissions”检测可写目录(仅限 Android),这些目录应被保护。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkDirPermissions();checkExecutingCommands
Section titled “checkExecutingCommands”执行 which su 样式命令来检测 root(仅限 Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkExecutingCommands();checkInstalledPackages
Section titled “checkInstalledPackages”检测 Android 上的可疑安装包。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkInstalledPackages();checkforOverTheAirCertificates
Section titled “checkforOverTheAirCertificates”检测 Android 上的 OTA 证书被篡改情况(仅限 Android)
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkforOverTheAirCertificates();isRunningOnEmulator
标题:isRunningOnEmulator仅限 Android,检测常见的仿真器指纹(Android only)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.isRunningOnEmulator();simpleCheckEmulator
标题:simpleCheckEmulator仅限 Android,轻量级仿真器检查(Android only)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.simpleCheckEmulator();simpleCheckSDKBF86
标题:simpleCheckSDKBF86仅限 Android,检测 x86 仿真器指纹(Android only)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.simpleCheckSDKBF86();simpleCheckQRREFPH
标题:simpleCheckQRREFPH仅限 Android,检测 QC 参考手机构建(Android only)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.simpleCheckQRREFPH();simpleCheckBuild
标题:简单检查构建检测 Android 构建主机异常
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.simpleCheckBuild();checkGenymotion
标题:检查 Genymotion检测 Genymotion 模拟器指纹(仅限 Android)
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkGenymotion();checkGeneric
标题:检查通用检测通用模拟器指纹(仅限 Android)
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkGeneric();checkGoogleSDK
标题:检查 Google SDK检测 Google SDK 模拟器指纹(仅限 Android)
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkGoogleSDK();togetDeviceInfo
标题:获取设备信息返回检测过程中收集的设备信息。
提供了设备在根检测过程中收集的额外上下文和元数据。有助于调试和日志记录。
import { IsRoot } from '@capgo/capacitor-is-root';
const deviceInfo = await IsRoot.togetDeviceInfo();console.log('Device info:', deviceInfo);isRootedWithEmulator
标题:检测是否为模拟器仅限 Android,扩展了默认检测模块,增加了模拟器检测逻辑。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.isRootedWithEmulator();isRootedWithBusyBoxWithEmulator
标题:检测是否为模拟器(BusyBox)仅限 Android,扩展了 BusyBox 检测模块,增加了模拟器检测逻辑。
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在上游发生变化时,请重新运行同步。