跳过主要内容
返回插件
@capgo/capacitor-is-root
教程
由 github.com/Cap-go

是否为root

检测根设备的安卓或越狱的iOS设备以增强应用安全性

指南

Is Root 教程

使用 @capgo/capacitor-is-root

Capacitor 根据设备类型检测是否为根设备的插件

安装

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

本插件暴露的内容

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

示例用法

isRooted

- 执行默认的root/jailbreak检测检查。

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

- 在Android设备上扩展默认检测,使用BusyBox特定的检查。

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

await IsRoot.isRootedWithBusyBox();

detectRootManagementApps

- 检测是否存在已知的root管理应用程序(仅限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的实现细节 入门指南 了解入门指南的实现细节 Capgo 插件目录 了解Capgo 插件目录中的产品工作流程 Capacitor 插件由 Capgo 提供 for the implementation detail in Capacitor Plugins by Capgo, and 添加或更新插件 为添加或更新插件的实现细节提供